Before asking this question I have looked at all related questions, but have not found anything relevant.
In my application I have toolbox style bar, which is basically stack panel with bunch of buttons. User may change which buttons are shown in toolbar.
Window width may be changed, but it can not be smaller then width of toolbar.
At first I was hoping to bind the MinWidth
property to the StackPanel
Width
property and create converter that adds few pixels to Width
of the StackPanel
. The problem is that my converter does not get Width of StackPanel
, just NaN as value :(
Unfortunately, StackPanel
width is set to Auto
and I can not change that.
Is there any way I can make my Window MinWidth
dependable on Width
of StackPanel
?
Use ActualWidth
, not Width
.
Width is the requested width, or NaN for "Auto", ActualWidth
is the, well, actual width after all the layout is calculated.