Binding for MinWidth property does not work in Silverlight
Posted
by
Akash Kava
on Stack Overflow
See other posts from Stack Overflow
or by Akash Kava
Published on 2010-12-29T10:50:46Z
Indexed on
2010/12/29
10:53 UTC
Read the original article
Hit count: 242
I have noticed something very unusual today, I need to bind "MinWidth" property of TextBlock to some value, however following example does not work. It only accepts MinWidth at a time of creation, but after that it is not affected at all if LeftWidth property is changed at runtime, however if I bind LeftWidth property to WidthProperty it works well.
Binding b = new Binding("LeftWidth");
// following never changes layout of control
tb.SetBinding(TextBlock.MinWidthProperty,b);
However, this one works correctly,
// following never changes layout of control
tb.SetBinding(TextBlock.WidthProperty,b);
Now I also did hook events and tried to do InvalidateMeasure and InvalidateArrange on TextBlock, but it has no effect. Seems like Changing MinWidth Property after layout pass does not work at all.
Can it be a bug in Silverlight? or Does anyone have any idea at all why MinWidth does not redo the layout?
© Stack Overflow or respective owner