Reputation: 11538
I have applied the following style to the CalendarStyle property of DatePicker:
<Style x:Key="myStyle" TargetType="Calendar" >
<Setter Property="Height" Value="Auto" />
<Setter Property="Width" Value="Auto" />
<Setter Property="RenderTransform">
<Setter.Value>
<TransformGroup>
<ScaleTransform ScaleX="1.5" ScaleY="1.5"/>
</TransformGroup>
</Setter.Value>
</Setter>
</Style>
but the calendar which opens up is cut-off from the right. Any ideas why?
Upvotes: 0
Views: 2454
Reputation: 21
Try this:
<Style x:Key="myStyle" TargetType="Calendar" >
<Setter Property="Height" Value="Auto" />
<Setter Property="Width" Value="Auto" />
<Setter Property="LayoutTransform">
<Setter.Value>
<TransformGroup>
<ScaleTransform ScaleX="1.5" ScaleY="1.5"/>
</TransformGroup>
</Setter.Value>
</Setter>
</Style>
Upvotes: 2
Reputation: 26
I was able to successfully re-size the calendar in the DatePicker by modifying the Template of Calendar and wrapping it inside a ViewBox. With that, the Calendar will pick up the size provided by the ViewBox. I have provided the solution in my blog entry here: Re-sizing Calendar in DatePicker
Hope it helped. :)
Upvotes: 1
Reputation: 19339
I am going to strike a guess at this, but I'm not entirely sure.
My guess is that the Calendar is contained in a Grid or a Canvas, or some other container, and naturally fills the container or is simply very close in size. When you apply the RenderTransform which scales the Calendar by 1.5, the container is still the same size, but the Calendar is now 1.5 times bigger, and therefore exceeds the size of the container.
Proposed solution:
Upvotes: 1