DatePicker do not show full month name at top because of style inheritance

206 Views Asked by At

I have a situation where i have to display the DatePicker , The problem is i am not able to see the complete month name at top, i am just able to see the first digit of december with dots after like "D.." whereas there is enough space to show entire month name. Its because it is inheriting many style of textbox/textblock from controltemplate which i am not including.

enter image description here

Here is my try :

<DatePicker  
  FontSize="6"
  SelectedDate="{x:Static sys:DateTime.Now}" 
  HorizontalContentAlignment="Left">
</DatePicker>

<Style  TargetType="{x:Type DatePickerTextBox}" >
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate>
                <TextBox
                    x:Name="PART_TextBox"
                    HorizontalAlignment="Left"
                    VerticalContentAlignment="Center"                       
                    Text="{Binding Path=SelectedDate, ConverterCulture={x:Static glob:CultureInfo.InvariantCulture}, StringFormat={}{0:yyyy-MM-dd}, RelativeSource={RelativeSource AncestorType={x:Type DatePicker}}}" />
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="IsReadOnly" Value="True" />
</Style>
    <Style  TargetType="{x:Type DatePicker}">            
    <Setter Property="Background" Value="{StaticResource FlowWhiteBrush}" />
</Style>

How to fix it such that we override the previous style by rewriting in the template written above and make it's alignment in left so that all month appears? But which styles and properties to be overridden?

0

There are 0 best solutions below