mc-petry
mc-petry

Reputation: 11

Whether you need to specify the binding mode datatrigger

1) <DataTrigger Binding="{Binding PropName}" Value="True">
2) <DataTrigger Binding="{Binding PropName, Mode=OneWay}" Value="True">
3) <DataTrigger Binding="{Binding PropName, Mode=TwoWay}" Value="True">

Everywhere uses the first option. A second and third I almost never met. Do I need to explicitly specify the binding mode? Interests in terms of performance and memory leaks.

Upvotes: 1

Views: 782

Answers (1)

Anatolii Gabuza
Anatolii Gabuza

Reputation: 6260

There is no need to specify binding Mode for DataTrigger because what it actually does is monitoring your property changed event and firing appropriate action when property value will met condition (e.g. will be equal to Value). It can't change value so TwoWay absolutely useless here. Regarding OneWay - same story, there is no reason to block source updating because as we no it can't be changed from DataTrigger.

Upvotes: 1

Related Questions