With DataTriggers in WPF, you can set properties on controls based on a related object. For example, you can set the TextBlock background based on the IsAlive property on your object.
<DataTrigger Binding="{Binding Path=IsAlive}" Value="true"> <Setter Property="Background" Value="Yellow"/> </DataTrigger>
I want to know if it is possible to return in the opposite direction. Is it possible to set a property on a database item based on the state of the control associated with it?
Let's say I want to set the IsAlive property to true when the control is bound to a mouseover event.
Can this be done in WPF and data triggers? Thanks.
Tom jones
source share