WPF DatePicker UpdateSourceTrigger属性更改不起作用
我正在使用MVVM,希望启用datepicker控件的文本更改按钮 XAML代码: 日期选择器上的绑定WPF DatePicker UpdateSourceTrigger属性更改不起作用,wpf,updatesourcetrigger,Wpf,Updatesourcetrigger,我正在使用MVVM,希望启用datepicker控件的文本更改按钮 XAML代码: 日期选择器上的绑定 SelectedDate="{Binding InactiveDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" DisplayDate="{Binding InactiveDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> 绑定按钮: <Button M
SelectedDate="{Binding InactiveDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
DisplayDate="{Binding InactiveDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
绑定按钮:
<Button Margin="10" Command="{Binding SubmitCommand}"
AllowSubmit实现
private bool AllowSubmit()
{
return InactiveDate != null;
}
public DateTime? InactiveDate
{
get
{
return _inactiveDate;
}
set
{
_inactiveDate = value;
SubmitCommand.RaiseCanExecuteChanged();
PropertyChanged(this, new PropertyChangedEventArgs("InactiveDate"));
}
}
不活动属性实现
private bool AllowSubmit()
{
return InactiveDate != null;
}
public DateTime? InactiveDate
{
get
{
return _inactiveDate;
}
set
{
_inactiveDate = value;
SubmitCommand.RaiseCanExecuteChanged();
PropertyChanged(this, new PropertyChangedEventArgs("InactiveDate"));
}
}
SubmitCommand.RaiseCanceTechChanged()
应在我在DateTimePicker上输入任何字符后启用该按钮,但该按钮未出现。选定的日期属性无法正常工作。我现在可能有点晚了,但您可以使用RadDatePicker的CurrentDateTimeText属性。选定的日期属性无法正常工作。我现在可能有点晚了,但您可以使用RadDatePicker的CurrentDateTimeText属性
SelectedDate="{Binding InactiveDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
DisplayDate="{Binding InactiveDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">