WPF MVVM模式下的 textbox控件的文本改變事件

解決:

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>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章