WPF MVVM模式下的 textbox控制元件的文字改變事件 的設定
阿新 • • 發佈:2019-02-10
問題描述:如題
解決方法:
1、新增 System.Windows.Interactivity.dll的引用
2、在程式碼設計XML介面新增引用:
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
textbox程式碼:
<TextBox Grid.Row="2" Grid.Column="2" IsReadOnly="False" Text="{Binding ZDMC}" Margin="5,3,21,2" TextChanged=""> <i:Interaction.Triggers> <i:EventTrigger EventName="TextChanged"> <i:InvokeCommandAction Command="{Binding TextChangedCommand}"/> </i:EventTrigger> </i:Interaction.Triggers> </TextBox>