I want to create 4 rectangles stacked to one row.
|—-|–|——|————|
The width of every rectangle is binded to value in %.
I decided to group rectangles to horizontal StackPanel. To calculate the width of the rectangle I want to write convertor.
What I don’t know is how to create converter that must be binded to: – value in % I want to pass the width of parent to converter parameter.
How to write parameter to bind it to parent’s width?
Thank you for your answers.
Get rid of the StackPanel and put a Grid with one row and 4 column, That will do the trick. You can resize the control and it will behave properly. Bellow code the ColumnDefinition Width is actually a Percentage value. for example the first rectangle bellow takes 20% of the total width because the ColumnDefinition set 0.2* on that column.