I am using a DatePicker in my app defined as such:
<DatePicker Width="200"
Margin="20, 20, 20, 0"
SelectedDate="{Binding PeriodEndDate, Mode=TwoWay}" />
Here is how the date picker is displayed:
How can I get the date (4/22/2015) to center vertically in the textbox (the dotted line around the date is the actual textbox boundary)?
I have tried setting both VerticalContentAlignment
and VerticalAlignment
to Center
but this doesn't affect the date centering.
If I dig into the date picker using Snoops I can see an element called PART_TextBox
within the DatePicker
. If I change this PART_TextBox
VerticalContentAlignment
to Center
, the text will be centered (is set to Stretch
by default). However, I do not know how to access this subcomponent to change it's VerticalContentAlignment