I want to bind a control's Width to the parent's Width, but to a certain scale. Is there a way to do something like this:
<Rectangle Name="rectangle1" Width="{Binding ActualWidth*0.3, ElementName=thumbnailCanvas, UpdateSourceTrigger=PropertyChanged}" Height="{Binding ActualHeight, ElementName=thumbnailCanvas, UpdateSourceTrigger=PropertyChanged}"/>
Sure, but you will need to use a converter. Something like this one:
And your XAML will look like:
I'd recommend simply doing this in XAML using a grid columns and the * width type:
You can change the ratio of how much the columns take up by changing the numbers before the * in the column widths. Here it's setup as 1 and 2, so the grid will be split in 3 (sum of all * widths), with 1/3 of width to first column and 2/3 to second column.