我想要为我的 TimePicker 选择日期。当我从显示在我的视图窗口中的日历中选择特定日期时,该日期应分配给 Timepicker。
xml:
<DataTemplate x:Key="EditableDataTemplate">
<StackPanel Orientation="Horizontal" Width="596">
<xctk:TimePicker Name="StartPicker" Value="{Binding StartTime, Mode=TwoWay}" Format="Custom" FormatString="hh:mm tt" Background="Yellow" Padding="0" Margin="0" BorderThickness="0" Width="100" EndTime="11:59:0"/>
<xctk:TimePicker Name="EndPicker" Value="{Binding EndTime, Mode=TwoWay}" Format="Custom" FormatString="hh:mm tt" Background="Yellow" Padding="0" Margin="0" BorderThickness="0" Width="60" EndTime="11:59:0"/>
</StackPanel>
</DataTemplate>
下面的属性更新 TimePicker 的时间,但设置今天的日期。我想要在运行时选择的选定日期。
private DateTime _started_at;
private DateTime _ended_at;
public DateTime StartTime
{
get
{
return _started_at;
}
set
{
_started_at = value;
}
}
public DateTime EndTime
{
get
{
return _ended_at;
}
set
{
_ended_at = value;
}
}
想法?