Ok this is my scenario.
I have a UserControl with a ListView and, for example, one TextBox bound to the ListView SelectedItem.
This works fine.
<ListView
x:Name="listviewUser"
IsSynchronizedWithCurrentItem="True">
<ListView.View>
<GridView>
<GridViewColumn Header="User Name"
DisplayMemberBinding="{Binding Path=UserName}" />
</ListView.View>
</ListView>
<TextBox >
<TextBox.Text>
<Binding ElementName="listviewUser"
Path="SelectedItem.UserName"
ValidatesOnDataErrors="True"
Mode="TwoWay"
UpdateSourceTrigger="PropertyChanged">
</Binding>
</TextBox.Text>
But i want to change the background color of the row selected when the text value of my textbox changes.
I hope I have been concise and thousand pardons if this question was already settled (I’m not very good at English).
Thank you very much
Several solutions that you can choose.
If you want to change in a small set of colors, use DataTrigger at XAML.
(note that the code below is not tested)
Use DataTemplateSelector for more complex color selection.
a good reference is: http://www.switchonthecode.com/tutorials/wpf-tutorial-how-to-use-a-datatemplateselector
Use event handler at the ItemTemplate. This is not recommended because you need to write at code-behind.