Hi,
i'm new in WPF so it's possible, that i make some mistakes. I'm trying to bind two ListBoxes
<ListBox Margin="8,12.07,0,8" SelectionChanged="lbApplications_SelectionChanged"
Grid.Row="1" x:Name="lbApplications" Width="267.914" HorizontalAlignment="Left"
ItemsSource="{Binding Path=Applications, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" />
<ListBox Margin="275.914,12.07,8,8" DisplayMemberPath="Message"
Grid.Row="1" x:Name="lbEvents" MouseDoubleClick="lbEvents_MouseDoubleClick"
ItemsSource="{Binding Path=Events, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" />
Applications and Events are public properties in Window class.
I set DataContext to 'this' to both listboxes and implement INotifyPropertyChanged to Window class:
private void NotifyPropertyChanged(string info)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
And then after adding new Item to Applications or Events i call
NotifyPropertyChanged("Events");
NotifyPropertyChanged("Applications");
The issue is that Listbox is loaded only one times. What am I doing wrong??
Thanks a lot for help.