tags:

views:

54

answers:

1

I have tried to override MeasureOverride, but the available size will not change when i resize a grid. which contains my control.

class MyFrameworkElement : FrameworkElement 
{
    override Size MeasureOverride(Size available)
    {
        this.Width = available.Width;
        this.Height = available.Width
        this.UpdateLayout();  // do something...
    }
}

This works only when application start.

How to implement a auto resize control, just like a TextBox in a grid cell. The TextBox will auto resize to fill grid cell if grid resized.

+1  A: 

It should resize it automatically, if you anchor your control to the form (something the user of your control does, not the control itself).

BlueRaja - Danny Pflughoeft