0

I have created 2 dependency property IsMonthYear and DateFormat.I have written two classes for just two properties which i found is not a efficient solution.Is there any better approach to display from and to datepicker in MM/yyyy format and also open a calender of month and year only.

<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>
mehak
  • 1
  • Possible duplicate of [Custom date format for textbox](https://stackoverflow.com/questions/36088998/custom-date-format-for-textbox) – Rekshino Feb 16 '18 at 11:54
  • Possible duplicate of https://stackoverflow.com/questions/14630318/c-sharp-and-date-picker-how-to-change-format – Rekshino Feb 16 '18 at 12:04

0 Answers0