Say I have 2 buttons in one element and I want to fill 2 elements always fill their 1/2 width each element Containing, can i do this
UPDATE
Why can not I do something like this
& lt; Stackpanel orientation = "horizontal" grid. Line = "0" & gt; & Lt; Button content = "click me" command = "{binding click command}" width = "1 *" /> & Lt; Button content = "exit" command = "{binding stop command}" width = "1 *" /> & Lt; / StackPanel & gt;
Why does 1 * not work in this context? I get an error
"1 *"
not converted Can be done
You can use the grid
with two columns for it.
& lt; Grid & gt; & Lt; Grid.ColumnDefinitions & gt; & Lt; Column width = "1 *" /> & Lt; Column width = "1 *" /> & Lt; /Grid.ColumnDefinitions> & Lt; Button grid Column = "0" & gt; Button 1 & lt; / Button & gt; & Lt; Button grid Column = "1" & gt; Button 2 & lt; / Button & gt; & Lt; / Grid & gt; Pay attention to the use of the star ( *
) in the ColumnDefinition.Width
property. This means that both columns will take the same amount of space, so in the above example, each button will occupy 1/2 of the available space with each in each. So if you make a width
equal to 2 *
, then that column will take the amount of space twice as the other column. Hope this makes sense.
Comments
Post a Comment