How can change the fill color of an object I\'m being to in my mvvm setup using xaml in wpf. I want to change the fill color to red when the attribute being bound to is set to
First of all you don't need any Binding
for what you are trying to do. DataTrigger
is enough. In the example below IsCyan
is a boolean
property of ViewModel
. But Background
of TextBlock
is not bound at all.
But if at all you need Binding, solution by the user benPearce to use Converter
is the way to go.