默认双向绑定的控件

控件 属性 说明
TextBox Text 默认 TwoWayUpdateSourceTrigger=LostFocus
CheckBox IsChecked 默认 TwoWay
RadioButton IsChecked 默认 TwoWay
Slider Value 默认 TwoWay
ScrollBar Value 默认 TwoWay
ProgressBar Value 默认 TwoWay
ListBox SelectedItem / SelectedIndex 默认 TwoWay
ComboBox SelectedItem / SelectedIndex 默认 TwoWay
DataGrid SelectedItem / CurrentCell 默认 TwoWay
DatePicker SelectedDate 默认 TwoWay

默认单向绑定的控件

控件 属性 说明
TextBlock Text 默认 OneWay,只显示不改
Label Content 默认 OneWay
Image Source 默认 OneWay
ItemsControl ItemsSource 默认 OneWay

快速记忆法

  • 用户可以改值的控件 → 默认 TwoWay(TextBox、CheckBox、ComboBox等)
  • 用户不能改值的控件 → 默认 OneWay(TextBlock、Label等)