本文介绍了比较开始时间大于结束时间WPF datepicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有一个RadTimePicker,我有开始时间和结束时间。我必须比较start是否大于结束时间。我正在使用WPF和MVVM。 < telerik:RadTimePicker Horizo​​ntalAlignment = 中心 VerticalAlignment = 中心 高度 = 自动 宽度 = 自动 DisplayFormat = 长 已移除 = LightYellow SelectedValue = {Binding PeriodSelected.StartTime.Time} FontSize = 12 / > < telerik: RadTimePicker Horizo​​ntalAlignment = Center VerticalAlignment = 中心高度= 自动 宽度= 自动 DisplayFormat = 长 Background = LightYellow SelectedValue = {Binding PeriodSelected.EndTime.Time} FontSize = 12 /> public EP_TimeBase StartTime { get { return _startTime; } set { _startTime = value ; RaisePropertyChanged( StartTime); } } private EP_TimeBase _endTime; public EP_TimeBase EndTime { get { return _endTime; } set { _endTime = value ; RaisePropertyChanged( EndTime); } } 解决方案 使用 ComapareValidator - < asp:comparevalidator id =CompareValidator1operator =GreaterThancontroltovalidate =RadDatePicker2controltocompare =RadDatePicker1errormessage =EndDate必须更大比StartDatexmlns:asp =#unknown>< / asp:comparevalidator> I have a RadTimePicker and i have start time and end time.I have to compare if start is greater than the end time or not.I am using WPF with MVVM.<telerik:RadTimePicker HorizontalAlignment="Center" VerticalAlignment="Center" Height="Auto" Width="Auto" DisplayFormat="Long" removed="LightYellow" SelectedValue="{Binding PeriodSelected.StartTime.Time}" FontSize="12"/><telerik:RadTimePicker HorizontalAlignment="Center" VerticalAlignment="Center" Height="Auto" Width="Auto" DisplayFormat="Long" Background="LightYellow" SelectedValue="{Binding PeriodSelected.EndTime.Time}" FontSize="12"/>public EP_TimeBase StartTime { get { return _startTime; } set { _startTime = value; RaisePropertyChanged("StartTime"); } } private EP_TimeBase _endTime; public EP_TimeBase EndTime { get { return _endTime; } set { _endTime = value; RaisePropertyChanged("EndTime"); } } 解决方案 Use ComapareValidator -<asp:comparevalidator id="CompareValidator1" operator="GreaterThan" controltovalidate="RadDatePicker2" controltocompare="RadDatePicker1" errormessage="EndDate must be greater than StartDate" xmlns:asp="#unknown"></asp:comparevalidator> 这篇关于比较开始时间大于结束时间WPF datepicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-28 05:59