When you try to put a WPF User Control or a Page inside of a container you will notice the control is not resizing to the parent it is hosted in. Example, a page that is hosted in a frame.
This is due to the size you have set to the control or page.
<Page x:Class=”LAD_Project_Planning_WPF.pProjectCard” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” Title=”pProjectCard” Loaded=”Page_Loaded” Height=”382″ Width=”789″>
As you can see the page’s height and width are set to 382 and 789 pixels. This will cause the control to always have these dimensions. It doesn’t matter if it is set to strech inside of a container or not.
Removing the dimensions from the control will solve this issue at runtime, but you won’t be able to see the control in design time.
The only solution I found until now was to change the dimensions in the OnLoad event.
if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
this.Width = double.NaN;
this.Height = double.NaN;