I'm trying to create a custom ItemContainerStyle for a ListView so that the text displayed is selectable. I'm looking to set the ItemsSource to a List<string>
. If I were binding to a List<Person>
(with property Name
) I could do
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListViewItem">
<StackPanel>
<TextBox Text="{Binding Path=Name}">
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
How do I specify the binding for a List<T>
?
Just
<TextBox Text="{Binding Mode=OneWay}">
will do.