I created a class derived from UserControl
My task is to control the size proportions of height and width. (If the container is inserted to control will resize it.) I need the control to be strictly square.
What should be done to change the new dimensions of the control? SizeChangedEventArgs.NewSize
property is read only.
private void MyControl_SizeChanged(object sender,SizeChangedEventArgs e)
{
if (e.NewSize.Height!=e.NewSize.Width)
{
// to-do ?
}
}
Width and Heigth in my case are NaN since the mode is set to Auto. I can not change manually Width or Height property since then Control will automatically fixed size and does not change when you scale grid in which it is placed.