Hsejar
Hsejar

Reputation: 1

How to change the Date Format in WPF

I want to change the date format of a datepicker control to display as shown below.

Äpr,23 - 2010

Any suggestions how to go about this ?

Upvotes: 0

Views: 333

Answers (1)

blindmeis
blindmeis

Reputation: 22435

 <Style TargetType="{x:Type DatePickerTextBox}">
    <Setter Property="Control.Template">
       <Setter.Value>
          <ControlTemplate>
            <TextBox x:Name="PART_TextBox" Text="{Binding Path=SelectedDate, StringFormat='MMM, dd - yyyy', 
 RelativeSource={RelativeSource AncestorType={x:Type DatePicker}}}" />
          </ControlTemplate>
        </Setter.Value>
      </Setter>
   </Style>

Upvotes: 1

Related Questions