mauede
Well-known member
I suspect that INotifyPropertyChanged is overkill for what I would like to achieve.
I need:
Questions:
I need:
- to display a list of strings in a ListBox (the 5th column in the attached picture that is not working yet)
- to allow the user to edit each ListBox Item and set the status of the contained string (Accepted/Rejected) through the associated CheckBox
- when the button "Confirm" is clicked, to get access to the ListBox Item strings and the associated Checkbox to save to a database the strings that have "Accepted" status
C#:
<ListBox x:Name="AutoStrucNames" Grid.Row="5" Grid.Column="100" Height="600" Margin="80,20,0,40" Width="160" SelectionMode="Single" HorizontalAlignment="Left" Grid.ColumnSpan="10" Background="PowderBlue"
DataContext="{Binding ElementName=main}" ItemsSource="{Binding AutoNames}" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox x:Name="CheckAccepted" Margin="3" VerticalAlignment="Center" IsChecked="{Binding IsChecked, Mode=TwoWay}" />
<TextBox Text="{Binding Value, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay }"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Questions:
- Do I need InotiftPropertyChanged to read the edited strings displayed by the ListBox when the Button "Confirm" is clicked?
- Do I need to define the set of strings as a List<string> or as an "ObservableCollection<string>"?