How to write a custom control, which can auto resize just like TextBox in a grid cell?
- by Cooper.Wu
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.