1
메신저 실버 체크 박스의 RadioButton 작업, 다음과 같은 시나리오가 :바인딩이 업데이트되기 전에 트리거 된 ToggleButton checked 이벤트가 트리거 되었습니까? 곤충?
의 DataContext를 :
public class ViewModel : INotifyPropertyChanged
{
bool isChecked;
public bool IsChecked
{
get { return isChecked; }
set
{
isChecked = value;
InvokePropertyChanged("IsChecked");
}
}
public void OnCheckBoxChecked()
{
// This function is run when the CheckBox Checked event triggers
}
public event PropertyChangedEventHandler PropertyChanged;
void InvokePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
보기 :
<UserControl x:Class="KSLog.Frontend.Features.CaseOverview.Views.CheckBoxView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid x:Name="LayoutRoot" Background="White">
<CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}" Checked="HandleInViewModel"/>
</Grid>
</UserControl>
당신이 체크 박스를 클릭 ' ViewModel.OnCheckBoxChecked '는 바인딩을 통해'ViewModel.IsChecked '가 업데이트되기 전에 실행됩니다. 'CheckBox.IsChecked'가 업데이트되었지만
이 버그와 디자인상의 차이입니까? 그것은 나에게 버그로 보인다! 그렇지 않으면 이벤트가 Checking 이라야합니까? :)
왜 이런 경우가 있는지 생각해보십시오.