Yannick Bersin

Yannick Bersin

  • NA
  • 3
  • 2.6k

[Beginner] How to change DatePicker inside button margin?

Sep 30 2015 11:38 AM
Hello,

I did not find howI could solve this. I would like to change DatePicker inside button margin for all DatePicker without having to rewrite the template.

I have found how I can do it on one DatePicker by putting this :

<DatePicker>
<DatePicker.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="Margin" Value="3,0,1,0" />
</Style>
</DatePicker.Resources>
</DatePicker>

But I would like to avoid doing this on all DatePciker controls on my application. I would like to do it on my general style file.

With Snoop, I had a look at the control and I noticed the Button name is PART_Button and the default margin is 3,0,3,0. I would like to set it to 3,0,1,0.
I don't want to affect all buttons, just the DatePicker inside button.

If someone could help me on this, I would appreciate
 
Yannick

Answers (2)