1
我在使用扩展wpf工具包的wpf应用程序中使用了TimePicker格式。我正在使用“HH:MM”格式。但问题是,该按钮允许直接从选项中选择小时,显示24小时格式,但我只需要12小时。但是,通过将Endtime从“23:59”更改为“11:59”,我通过TimePicker的属性来管理该属性。但那些上下按钮仍然显示小时数达到23.所以,如果我想弥补11,我该怎么办?我可以通过TimePicker的属性来实现吗?也没有显示部分时间,例如上午/下午。我还想要另一个按钮,它应该显示我这两个选项(即AM和PM)。请建议,我应该如何继续?如何使用属性更改TimePicker格式
这必将对DateTime对象在我的代码我Timepicker控件后面有:
<Window x:Class="TimeSheet.CustomView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
x:Name="Time"
Title="CustomView" Width="596" Height="596">
<Grid>
<StackPanel Orientation="Horizontal" Height="30" Width="596" Margin="0,137,-8,399">
<xctk:TimePicker x:Name="StartTimeText" Value="{Binding starttime, ElementName=Time, Mode=TwoWay}" BorderThickness="0" Background="Yellow" Width="113" EndTime="11:59:0" AllowSpin="False"/>
<xctk:TimePicker x:Name="StopTimeText" Value="{Binding stoptime, ElementName=Time, Mode=TwoWay}" BorderThickness="0" Background="Yellow" Width="115" EndTime="11:59:0" AllowSpin="False"/>
</StackPanel>
</Grid>
</Window>
我的窗口 -
但是,此控件没有TimeFormatString属性。它是FormatString属性。我有FormatString属性,但它不显示部分时间(即AM/PM)。 – Dinesh
对不起,我把它与'DateTimePicker'混合在一起。我编辑了答案 – Vanlalhriata
现在,它只显示AM的一部分。这意味着从凌晨1:00到凌晨12:00显示 – Dinesh