Possible Duplicate:
How to make ListBox editable when bound to a List<string>?
I'm trying to set a two-binding between a List named "ListStr" object and a ListBox WPF control. Besides I want the items to be editable, so I added a DataTemplate with TextBoxes expecting that it would modify the ListStr items straight away via TextBoxes.
But when I'm attempting to edit one of them, it doesn't work...
Any Idea ?
PS: I've tried to add the Mode=TwoWay parameter, but it's still not working
Here is the XAML :
<ListBox ItemsSource="{Binding Path=ListStr}" Style="{DynamicResource ResourceKey=stlItemTextContentListBoxEdit}" />
Here is the style code :
<Style x:Key="stlItemTextContentListBoxEdit" TargetType="{x:Type ListBox}">
<Setter Property="Background" Value="#FF0F2592" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Height" Value="150" />
<Setter Property="Width" Value="200" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="ItemTemplate" Value="{DynamicResource ResourceKey=dtplItemTextContentListBoxEdit}" /></Style>
And the DataTemplate:
<DataTemplate x:Key="dtplItemTextContentListBoxEdit">
<TextBox Text="{Binding Path=.}" Width="175" />
</DataTemplate>