-1

The Responsive UI,I know the VisualStateManager can do this work.Bu I don't know how to do

In wide mode, It have two columns.The First column show a list and the second show the content in the same page

WideMode

And in narrow mode, it only show one thing one time in a page and whit the navigation. Just like the Win10 Mail app.

narrow mode1

narrow mode2

Thanks so much

4

1 回答 1

0

这是一个 XAML 代码:

  <Grid Background="White">
    <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="VisualStateGroup">
            <VisualState x:Name="VisualStateNarrow">

                <VisualState.Setters>
                    <Setter Target="emailDetails.(UIElement.Visibility)" Value="Collapsed"/>
                    <Setter Target="emailsList.(Grid.ColumnSpan)" Value="2"/>
                </VisualState.Setters>
                <VisualState.StateTriggers>
                    <AdaptiveTrigger MinWindowWidth="1"/>
                </VisualState.StateTriggers>
            </VisualState>


            <VisualState x:Name="VisualStateExtended">
                <VisualState.StateTriggers>
                    <AdaptiveTrigger MinWindowWidth="700"/>
                </VisualState.StateTriggers>
            </VisualState>
        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>

    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="340" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>

    <!-- Emails List -->
    <Grid x:Name="emailsList" Background="LightBlue" >
        <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="Nothing to show!" />
    </Grid>

    <!-- Email Details -->
    <Grid Grid.Column="1" x:Name="emailDetails" Background="Blue" >
        <TextBlock HorizontalAlignment="Center" Foreground="White" VerticalAlignment="Center" Text="Select email to show!" />
    </Grid>

</Grid>

我已将“700 px”设置为扩展状态的最小宽度,您可以通过以下方式更改它:<AdaptiveTrigger MinWindowWidth="700"/>

于 2015-09-27T07:49:04.610 回答