Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to binding and change VM property value when DataTrigger?

$
0
0

Hi all,

Please see the below code. The current work is when mouse over myButton then set textbox value as 3. Then binding this value to ViewModel property, at this time, the new value of ViewModel property also be 3.

The textbox just like a bridge. Can I remove this bridge and change the VM property directly when <setter..... in myTrigger style? thanks.

<Style x:Key="myTrigger" TargetType="TextBox"><Style.Triggers><DataTrigger Binding="{Binding IsMouseOver, ElementName=myButton}" Value="True"><Setter Property="Text" Value="3"></Setter></DataTrigger></Style.Triggers></Style>


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>