Windows通用响应式设计重新定位
所以,我刚开始使用Windows应用程序重新开始工作,并且有一些事情我无法按自己的意愿工作(可能是因为我没有找到任何示例,Channel9视频并未覆盖我的案例)。
从本文开始,我决定“重新定位”技术适合从大屏幕移动到更小屏幕时的应用。
  我所做的是使用StackPanel并使用两个AdaptiveTrigger (一个用于0宽度,另一个用于720,基于此处的表格)更改其方向。 
这种方法可行,但我会用一些难看的油漆编辑的屏幕截图来说明一些问题。
  这就是我在BigScreen情况下发生的情况,在这种情况下,有足够的空间让A和B在同一行上。  这里的问题是B应该占据全部的剩余宽度,覆盖所有的蓝色部分。 

  第二个问题与调整大小有关。  当没有足够的空间时,绿色部分会被剪切而不是被调整大小(您可以看到右边框消失)。  这在使用StackPanel使布局响应之前没有发生。 

  最后,当我们处于SmallScreen状态时,方向改变为垂直方向,我们SmallScreen与第一个相同的问题:绿色部分的高度不会填满屏幕。 
  以下是用于该页面的XAML : 
<Page
    x:Class="Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:WifiAnalyzerFinal.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:mvvm="using:Mvvm"
    mc:Ignorable="d">        
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="SmallScreen">
            <VisualState>
                <VisualState.StateTriggers>
                    <AdaptiveTrigger MinWindowWidth="0"/>
                </VisualState.StateTriggers>
                <VisualState.Setters>
                    <Setter Target="StackPanel.Orientation" 
                            Value="Vertical"/>
                </VisualState.Setters>
            </VisualState>
            </VisualStateGroup>
            <VisualStateGroup x:Name="BigScreen">
            <VisualState>
                <VisualState.StateTriggers>
                    <AdaptiveTrigger MinWindowWidth="720"/>
                </VisualState.StateTriggers>
                <VisualState.Setters>
                    <Setter Target="StackPanel.Orientation" 
                            Value="Horizontal"/>
                    <Setter Target="Rect.Width" 
                            Value="200"/>
                        <Setter Target="Rect.Height" 
                            Value="Auto"/>
                    </VisualState.Setters>
            </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <StackPanel Orientation="Vertical"
                    Background="Blue"
                    x:Name="StackPanel">
            <Rectangle Fill="Red" 
                       Height="50"
                       x:Name="Rect"
                       Width="Auto"/>
            <ListView ItemsSource="{Binding Stuff}"
                      HorizontalAlignment="Stretch"
                      HorizontalContentAlignment="Stretch"
                      VerticalAlignment="Stretch"
                      Background="Green"
                      Width="Auto"
                      BorderBrush="DarkGreen"
                      BorderThickness="5"
                      Padding="5">
                <ListView.ItemContainerStyle>
                    <Style TargetType="ListViewItem">
                        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                        <Setter Property="Margin" Value="0,0,0,5"/>
                    </Style>
                </ListView.ItemContainerStyle>
            </ListView>
        </StackPanel>
    </Grid>
</Page>
  请注意,如果没有StackPanel ,绿色部分应该适合页面,覆盖所有可用区域。  不幸的是,我不能提出更好的解决方案,因为没有样本告诉我们应该如何实施这项技术。  我也尝试使用新的RelativePanel但似乎AdaptiveTrigger的Setter不能用于像RelativePanel.RightOf这样的附加属性。 
有没有人成功应用这种技术而不必使用代码隐藏技术?
编辑:
  我使用了一个2行2列的Grid ,使用AdaptiveTrigger将所有内容从行移动到列,反之亦然。 
可以通过setter更改RelativePanel附加属性值。 语法如下所示:
<Setter Target="SomeXAMLObject.(RelativePanel.RightOf)" Value="SomeOtherXAMLObject" />
你为什么不尝试使用网格(而不是StackPanel),并使用比例尺寸来定义行:
`<Grid>
 <Grid.RowDefinitions>
  <RowDefinition width="2*"/>
  <RowDefinition width="3*"/>
  <RowDefinition width="1*"/>
 </Grid.RowDefinitions>
</Grid>`
