Silverlight Get actual width of Grid that is set as Auto

2.1k views Asked by At

Say I have a Grid whose Width is set as Auto. Inside this grid I want to put a new grid that is a square. To do this I want the new grid's width and height to be equal. I thought I could just set the Width and Height to the Parent Grid's Width. The problem is, the Parent grid's width is double.NaN since it is set to auto.

My question, is there a way to get the ActualWidth of this parent grid, so that I know how wide it is? If not, is there another way to create a Rectangular Grid that fits inside the parent grid?

1

There are 1 answers

0
Shawn Mclean On

You have to use the property of ActualWidth

var width = LayoutRoot.ActualWidth;