How to write a custom control, which can auto resize just like TextBox in a grid cell?
Posted
by Cooper.Wu
on Stack Overflow
See other posts from Stack Overflow
or by Cooper.Wu
Published on 2010-04-30T00:04:46Z
Indexed on
2010/04/30
0:07 UTC
Read the original article
Hit count: 216
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.
© Stack Overflow or respective owner