U
U
Untiwe2021-09-02 11:34:33
WPF
Untiwe, 2021-09-02 11:34:33

Why is the bound context not updating?

I have a context-bound textbox

<TextBox Text="{Binding Path=LeftTeam.TeamCounter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"  />


If I try to update the context when creating a con, then everything is fine
public View _view = new View();
public MainWindow()
{
            InitializeComponent();
            DataContext = _view;
            _view.LeftTeam.TeamCounter = 7;//изменения видно
}


But when I try to do it later (button click event), the text doesn't change anymore
private void LeftTeamMinusOneCount(object sender, RoutedEventArgs e)
{
            _view.LeftTeam.TeamCounter = 9;//изменения НЕ видно
}

Through the debugger, you can see that the code is being executed and changes in the model are taking place. But the TextBox itself does not display the updated data

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question