WPF: Stretch Calendar horizontally

calendarwpfwpf-controls

Is there a way to stretch a WPF Calendar control horizontally? The control will let me set HorizontalAlignment="Stretch", but that has the same effect as setting the property to "Center". It changes the width of the control, but the displayed calendar remains the same size in the center of the control. I'd like to stretch the displayed calendar to the edges of the control.

I seem to remember it could be done with a ViewPort, but I can't find anything that shows how to do it. Thanks for your help.

Best Answer

I think you might be looking for Viewbox:

Defines a content decorator that can stretch and scale a single child to fill the available space.

If you make the Calendar a child of a Viewbox, it will apply a ScaleTransform to make it take up all the available space.

<Viewbox>
    <Calendar/>
</Viewbox>
Related Topic