When creating a UserControl in WPF, I find it convenient to give it some arbitrary Height and Width values so that I can view my changes in the Visual Studio designer. When
Some have suggested using the LicenseManager.UsageMode property which I've never seen before but I have used the following code.
if(!DesignerProperties.GetIsInDesignMode(this))
{
this.Width = double.NaN;
this.Height = double.NaN;
}
esskar,
I just want to add that you should generally always call the method of the base when overriding an "On" method.
protected override void OnVisualParentChanged(DependencyObject oldParent)
{
base.OnVisualParentChanged(oldParent);
...
}
Great workaround by the way, I'm using it myself now too.