在我的 WPF 应用程序中,我想为 TimePicker 控件设置选定的日期。在我的应用程序中,我在我的一个视图窗口中使用日历。当我从日历中选择一个日期并更改 TimePicker 值(即时间)并保存时,我的条目仅保存到今天的日期。我想将我的条目保存到选定的日期。那么,在这种情况下如何为 TimePicker 控件设置选择日期呢?
XAML:
<StackPanel Orientation="Horizontal" Width="596">
<TextBox Name="CltText" Text="{Binding ClientNameBinding,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Background="Yellow" Padding="0" Margin="0" BorderThickness="0" TextWrapping="Wrap" Width="145"/>
<TextBox Name="AppText" Text="{Binding ApplicationNameBinding}" Background="Yellow" Padding="0" Margin="0" BorderThickness="0" TextWrapping="Wrap" Width="90"/>
<xctk:TimePicker Name="StartPicker" Value="{Binding StartValue, ElementName=MainWin, 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 EndValue, ElementName=MainWin, Mode=TwoWay}" Format="Custom" FormatString="hh:mm tt" Background="Yellow" Padding="0" Margin="0" BorderThickness="0" Width="60" EndTime="11:59:0"/>
<TextBox Name="TaskText" Text="{Binding TaskNameBinding}" Background="Yellow" Padding="0" Margin="0" BorderThickness="0" TextWrapping="Wrap" Width="71"/>
<ComboBox x:Name="ProjectComboBox" ItemsSource="{Binding Path=projectList, ElementName=MainWin}" SelectedValuePath="_id" DisplayMemberPath="_name" SelectedItem="{Binding ProjectNameBindingClass, Mode=OneWayToSource}" Width="130" Background="Yellow" BorderThickness="0"/>
</StackPanel>