I have the following canvas :
<Canvas Width="800" Height="600">
<Rectangle Fill="#FF333333" Height="124" Width="500"
Canvas.Bottom="0" />
<Rectangle Fill="#FF333333" Height="124" Width="500"
Canvas.Bottom="150" Canvas.Left="150"/>
<Rectangle Fill="#FF333333" Height="124" Width="500"
Canvas.Bottom="300"/>
</Canvas>
I would like to get the size (width and height) of the rectangular space occupied by the group of rectangles. In the example above, I am expecting these values :
ContentWidth = 650 (= 500 + 150)
ContentHeight = 424 (= 300 + 124)
ActualWidth and ActualHeight return respectively 800 and 600, which is not what I want. Any idea?
Canvas.Children, calculating the 4 sides, and creating a rectangle out of them. I'm not sure if there's an easier way or not, as Canvas typically does not care what children it contains, so may not have anything to monitor the size of them. - Rachel