0

我目前有以下 xaml 代码,可在单击按钮时在界面左侧显示频道列表:

    <Button Content="Channels" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="109">
        <Button.Flyout>
            <Flyout Placement="Left">
                <Grid>
                    <TextBlock Text="Channels" 
                               FontSize="45.333" FontFamily="Segoe WP Light"
                               TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Height="48" Width="200" FontWeight="Light" OpticalMarginAlignment="TrimSideBearings" TextReadingOrder="DetectFromContent"/>
                    <ScrollViewer Margin="0,53,0,54" ZoomMode="Disabled">
                        <ListView Margin ="10,0" ItemsSource="{Binding Channels}" Width="189" ItemTemplate="{StaticResource ChannelTemplate}" x:Name="channelListView" IsTapEnabled="False" IsRightTapEnabled="False" IsHoldingEnabled="False" IsDoubleTapEnabled="False" Height="715"/>
                    </ScrollViewer>
                </Grid>
                <Flyout.FlyoutPresenterStyle>
                    <Style TargetType="FlyoutPresenter">
                        <Setter Property="ScrollViewer.ZoomMode" Value="Disabled"/>
                        <Setter Property="MaxWidth" Value="200"/>
                    </Style>
                </Flyout.FlyoutPresenterStyle>
            </Flyout>
        </Button.Flyout>
    </Button>

这是一个屏幕截图:

频道列表截图

但是,当尝试对界面右侧的用户列表使用类似的代码时,用户列表不会出现在右侧——而是在左侧:

    <Button Content="Users" Margin="281,0,10,0" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="58">
        <Button.Flyout>
            <Flyout Placement="Right">
                <Grid>
                    <TextBlock Text="Users" 
                               FontSize="45.333" FontFamily="Segoe WP Light"
                               TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Height="48" Width="200" FontWeight="Light" OpticalMarginAlignment="TrimSideBearings" TextReadingOrder="DetectFromContent"/>
                    <ScrollViewer Margin="0,53,0,54" ZoomMode="Disabled">
                        <ListView Margin ="10,0" ItemsSource="{Binding Channels}" Width="189" ItemTemplate="{StaticResource ChannelTemplate}" x:Name="usersListView" IsTapEnabled="False" IsRightTapEnabled="False" IsHoldingEnabled="False" IsDoubleTapEnabled="False" Height="715"/>
                    </ScrollViewer>
                </Grid>
                <Flyout.FlyoutPresenterStyle>
                    <Style TargetType="FlyoutPresenter">
                        <Setter Property="ScrollViewer.ZoomMode" Value="Disabled"/>
                        <Setter Property="MaxWidth" Value="200"/>
                    </Style>
                </Flyout.FlyoutPresenterStyle>
            </Flyout>
        </Button.Flyout>
    </Button>

用户列表截图

在此处输入图像描述

除了 ,我还需要做些<Flyout Placement="Right">什么吗?如果是这样,是什么?

4

0 回答 0