我已经创建了2个依赖属性IsMonthYear和DateFormat.I 我找到的只有两个属性的两个类不是一个有效的解决方案。有没有更好的方法来显示MM / yyyy格式的datepicker并且还只打开一个月份和年份的日历。
<DatePicker Grid.Column="0"
local:DatePickerCalendar.IsMonthYear="True"
local:DatePickerDateFormat.DateFormat="MM/yyyy"
Name="FromDate_Picker"
Width="Auto"
Margin="38,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
KeyboardNavigation.TabIndex="1"
Padding="0"
Text="MM/yyyy"
SelectedDate="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type Window}},
Path=DataContext.OutageStartDate,
StringFormat='MM yyyy',
Mode=TwoWay}"
Style="{DynamicResource supplyDisruptiondDatePicker}"></DatePicker>