Windows 10 Universal app flyout,如何去除滚动条?
Windows 10 Universal app flyout, how to remove scrollbars?
我有一个 Flyout
视图,里面有一个 TextBlock。文本块有超过一行的文本量,我希望它像往常一样换行到下一行,但是当在 Flyout
中使用时,它会滚出屏幕...如何禁用Flyout
?
中的滚动视图
弹出窗口 XAML:
...
<AppBarButton.Flyout>
<Flyout Placement="Full">
<local:MyView/>
</Flyout>
</AppBarButton.Flyout>
...
我的观点XAML:
<UserControl ...>
<Grid>
...
<TextBlock Text="Loading..." Style="{ThemeResource SubtitleTextBlockStyle}" Margin="10,0,10,20" Grid.Row="1" TextWrapping="Wrap"/>
</Grid>
</UserControl>
结果是这样的:
你可以
1) 为您的弹出按钮设置最大宽度
或
2) 试试这个:
<Flyout Placement="full" >
<Grid ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
........
</Grid>
</Flyout>
祝你好运!
要设置 Flyout 的属性,如宽度或滚动条的可见性,我们需要自定义 FlyoutPresenter 的样式。这是我的做法:
<Flyout Placement="Full" >
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"></Setter>
</Style>
</Flyout.FlyoutPresenterStyle>
<Grid>
<TextBlock Text="This is an informational flyout. Click outside to dismiss.xxxjfdalisfsadpfuaspdfoia" Grid.Row="1" TextWrapping="Wrap"/>
</Grid>
</Flyout>
直接将 复制到您的 Flyout 元素中即可满足您的要求。
我有一个 Flyout
视图,里面有一个 TextBlock。文本块有超过一行的文本量,我希望它像往常一样换行到下一行,但是当在 Flyout
中使用时,它会滚出屏幕...如何禁用Flyout
?
弹出窗口 XAML:
...
<AppBarButton.Flyout>
<Flyout Placement="Full">
<local:MyView/>
</Flyout>
</AppBarButton.Flyout>
...
我的观点XAML:
<UserControl ...>
<Grid>
...
<TextBlock Text="Loading..." Style="{ThemeResource SubtitleTextBlockStyle}" Margin="10,0,10,20" Grid.Row="1" TextWrapping="Wrap"/>
</Grid>
</UserControl>
结果是这样的:
你可以 1) 为您的弹出按钮设置最大宽度
或
2) 试试这个:
<Flyout Placement="full" >
<Grid ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
........
</Grid>
</Flyout>
祝你好运!
要设置 Flyout 的属性,如宽度或滚动条的可见性,我们需要自定义 FlyoutPresenter 的样式。这是我的做法:
<Flyout Placement="Full" >
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"></Setter>
</Style>
</Flyout.FlyoutPresenterStyle>
<Grid>
<TextBlock Text="This is an informational flyout. Click outside to dismiss.xxxjfdalisfsadpfuaspdfoia" Grid.Row="1" TextWrapping="Wrap"/>
</Grid>
</Flyout>
直接将 复制到您的 Flyout 元素中即可满足您的要求。