InterviewSolution
| 1. |
What Does Adaptive Trigger In Windows 10 Uwp? |
|
Answer» AdaptiveTrigger can help you create a dynamic responsive UI based on the height or width of the device or screen. It has two important PROPERTIES: MinWindowWidth and MinWindowHeight. <Page> <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup> <VisualState> <VisualState.StateTriggers> <!--VisualState to be triggered when window width is >=750 and windows height is >=900 effective pixels.--> <AdaptiveTrigger MinWindowWidth="750" MinWindowHeight="900" /> </VisualState.StateTriggers> <VisualState.Setters> <Setter Target="myPanel.Orientation" Value="Horizontal" /> </VisualState.Setters> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <StackPanel x:Name="myPanel" Orientation="Vertical"> <TextBlock Text="text block 1. "/> <TextBlock Text="text block 2. "/> <TextBlock Text="text block 3. " /> </StackPanel> </Grid> </Page> From above code, StateTriggers property with an AdaptiveTrigger to create a DECLARATIVE rule in XAML MARKUP based on window size. By default, the StackPanel orientation is Vertical. When the window width is >= 750 and the windows height is >=900 effective pixels, the VisualState change is triggered, and the StackPanel orientation is changed to Horizontal. AdaptiveTrigger can help you create a dynamic responsive UI based on the height or width of the device or screen. It has two important properties: MinWindowWidth and MinWindowHeight. XAML <Page> <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup> <VisualState> <VisualState.StateTriggers> <!--VisualState to be triggered when window width is >=750 and windows height is >=900 effective pixels.--> <AdaptiveTrigger MinWindowWidth="750" MinWindowHeight="900" /> </VisualState.StateTriggers> <VisualState.Setters> <Setter Target="myPanel.Orientation" Value="Horizontal" /> </VisualState.Setters> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <StackPanel x:Name="myPanel" Orientation="Vertical"> <TextBlock Text="text block 1. "/> <TextBlock Text="text block 2. "/> <TextBlock Text="text block 3. " /> </StackPanel> </Grid> </Page> From above code, StateTriggers property with an AdaptiveTrigger to create a declarative rule in XAML markup based on window size. By default, the StackPanel orientation is Vertical. When the window width is >= 750 and the windows height is >=900 effective pixels, the VisualState change is triggered, and the StackPanel orientation is changed to Horizontal. |
|