How to keep the data source updated in all WPF custom elements?
I have a WPF application with one main window .
This window has a series of buttons that form a menu and a space in which custom controls are loaded at runtime .
However, if a user modifies data (stored in an XML file) in one custom control and then switches to another custom control, the user does not see the updated data in the new custom control . The user has to restart the application to see the changes.
This is how my view is bound to the ModelView, which in turn receives data from the model (ObservableCollection):
<UserControl.Resources>
<local:CustomersViewModel x:Key="CustomersDataProvider"/>
</UserControl.Resources>
<ListBox
ItemsSource="{Binding Path=GetAll, Source={StaticResource CustomersDataProvider}}"
ItemTemplate="{StaticResource CustomersDataTemplate}"/>
So how can I now, when the data binding is only defined in XAML, tell the browser to retrieve the data from the viewmodel (possibly in a code-behind-class constuctor)?
0
a source to share
2 answers