I created a bar graph using rectangles whose size is proportional to the border of the graph. However when switch to a different layout such as snap view, only the border’s size changes and not the length of the rectangle. How do I detect when the layout or resolution changes and call a function to update the rectangle’s length?
Share
You should probably use just the basic VisualStateManager for changing layout when Snapped/FullScreenPortrait/FullScreenLandscape.
In case you need more advanced behavior, use this approach:
– add SizeChanged handler to your Page
– also name the root Grid/Panel element as x:Name=”Root” in your app and make it stretch horizontally and vertically.
– in the SizeChanged event handler you can find the actual screen size by accessing the Root.ActualWidth and Root.ActualHeight. Here you can show/hide/change/resize anything you want.