I have a Win8 app with a custom control, GameView, which I have instantiated three times (as gvMap, gvOurBase, and gvEnemyBase) on my page, and placed into a grid. I need to get the actual size of the control so I can set the RenderTransform and render everything with the proper scaling.
However, whenever I attempt to get the ActualWidth
or ActualHeight
of my controls, I always get zero. This occurs even if I wait until the page is loaded and call Measure and Arrange on my controls.
How can I get the size of my controls? Or am I not allowed to do this while they are in a grid? Is there another way for me to do the RenderTransform that doesn't rely on the size of the controls? I want each control to show a specific section of the whole game map - gvMap shows the whole map, gvOurBase shows the section of the map that the player has cities, and gvEnemyBase shows the section of the map that the enemy has cities.