在以下代码中,Scrollbar控件不会显示,但Slider控件会显示.如果我将Scrollbar控件更改为Slider控件只需将Scrollbar更改为Slider就可以完美地运行,但是我更喜欢滚动条控件在应用程序滑块上的外观.
我手动使用Win2D将大型1000格x 1000单元网格绘制到动画画布中,但仅使用滚动条(滑块)位置显示滚动到的部分.
使用Slider控件时可以正常工作.
<Page x:Class="TrappedEditor.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:TrappedEditor" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:canvas="using:Microsoft.Graphics.Canvas.UI.Xaml" Unloaded="Page_Unloaded" mc:Ignorable="d"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" SizeChanged="Grid_SizeChanged"> <Grid.ColumnDeFinitions> <ColumnDeFinition Width="1*"/> <ColumnDeFinition Width="50"/> </Grid.ColumnDeFinitions> <Grid.RowDeFinitions> <RowDeFinition Height="*"/> <RowDeFinition Height="50"/> </Grid.RowDeFinitions> <ScrollBar x:Name="scrollBarVertical" Visibility="Visible" Grid.Row="0" Grid.Column="1" ValueChanged="scrollBarVertical_ValueChanged" Orientation="Vertical" Minimum="0" Maximum="1000"/> <Slider x:Name="scrollBarHorizontal" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Orientation="Horizontal" ValueChanged="scrollBarHorizontal_ValueChanged" Minimum="0" Maximum="1000"/> <canvas:CanvasAnimatedControl Grid.Row="0" Grid.Column="0" x:Name="canvas" Draw="canvas_Draw" CreateResources="canvas_CreateResources"/> </Grid>
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。