I want to have a "Custom" item inside a ListBox, so that the user can enter custom values apart from the preset selectable values.
Here's my XAML code:
<ListBox SelectedValue="{Binding SomeValue}"
SelectedValuePath="Tag"
Style="{StaticResource HorizontalRadioButtonList}">
<!-- style from http://stackoverflow.com/a/4120034/1813487 -->
<ListBoxItem Tag="10"
Content="10"/>
<ListBoxItem Tag="20"
Content="20"/>
<ListBoxItem Tag="30"
Content="30"/>
<ListBoxItem x:Name="CustomListBoxItem">
<TextBox Text="{Binding ElementName=CustomListBoxItem,
Mode=OneWayToSource,
UpdateSourceTrigger=PropertyChanged,
Path=Tag}"/>
</ListBoxItem>
</ListBox>
<TextBlock Text="{Binding SomeValue}"/>
How to make SomeValue update as soon as the user enters something in the TextBox? Currently the ListBox does not detect that the Tag changed, and does not update SomeValue.