举例:
<TextBox Text="{Binding Name,Mode=TwoWay}" Height="23" HorizontalAlignment="Left" Margin="114,144,0,0" Name="textBox2" VerticalAlignment="Top" Width="120" />
Binding Name:其中的Name是VM中的一个属性
Mode:
oneTime:一次性绑定,将数据给控件,绑定就结束
oneWay:数据源改变会影响绑定该数据源的控件
twoWay:数据源改变会影响绑定该数据源的控件,并且控件中数据改变时也会影响到数据源
http://www.cnblogs.com/sydeveloper/archive/2012/04/27/2443098.html
<Button Command="{Binding ClickCommand}" Height="23" HorizontalAlignment="Left" Margin="12,0,0,72" Name="btnClick" VerticalAlignment="Bottom" Width="75">Click me</Button>
Binding ClickCommand:ClickCommand在VM中===>public ICommand ClickCommand{get; set;}