I am working with MVVM and WPF.
VM contains -
- an Observable collection of Task (where Task is a class that has public properties TaskId, TaskTime and TaskDetails)
- CurrentTaskId
I can set background color of each rows by using one of the method below
- using ListView ItemContainerStyle Trigger OR
- using ListView ItemContainerStyleSelector
Now I want to set the background color of all the rows to LightBlue and the condition being Task.TaskId == VM.CurrentTaskId. How do I achive this?
I failed to implement it using the data trigger on the style because
<DataTrigger Binding="{Binding TaskId}" Value="1001">
is valid but using Binding for Value is not valid, something on the lines of
<DataTrigger Binding="{Binding TaskId}" Value="{Binding CurrentTaskId}">
I am able to implement the alternate row color and a specific color for certain rows using the StyleSelector but again how do I find the CurrentTaskId?
Also how would I implement the functionality to change background color everytime the CurrentTaskId changes?