silverlight 滚动查看器和带硬件设置的画布。即使空间很大,也无法隐藏垂直条
带有托管画布对象的 tabcontrol 的 Silverlight 项目。我想用滚动查看器包装整个选项卡控件,以便在短显示上您可以垂直滚动以查看画布上的整个区域。
当我运行我的项目时,即使垂直空间比滚动条所需的空间多,我的滚动查看器垂直条也始终显示。
我在这里想要实现的目标是最小分辨率为 1280x768 以便可滚动,任何大于该分辨率的内容都会隐藏滚动条。我的笔记本电脑只有 768 高,但我的画布是在开发时考虑到 1280x1024 的。所以我想要一种方法来设置它,以便每个人都可以根据他们的分辨率滚动或一次看到画布。
有人知道为什么它总是可见吗?我尝试过设置画布的宽度和高度。我尝试在外部网格上的对齐方式上设置拉伸。在搜索与我类似的其他问题时看到了这两个提示。
一些代码:
<Grid x:Name="LayoutRoot" MinHeight="768" MaxHeight="1024" MinWidth="1024" MaxWidth="1280" Background="#FF6A6868" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.775*"/>
<ColumnDefinition Width="0.225*"/>
</Grid.ColumnDefinitions>
<ScrollViewer VerticalScrollBarVisibility="Auto" MinHeight="768" MaxHeight="1000" MinWidth="1024" MaxWidth="1280" Width="1280" Grid.ColumnSpan="2">
<sdk:TabControl TabStripPlacement="Top" Grid.ColumnSpan="2">
<sdk:TabItem Margin="0" Header="Main Floor">
<Canvas x:Name="Main_Floor" HorizontalAlignment="Left" Height="1024" MinHeight="768" UseLayoutRounding="False" VerticalAlignment="Top" Width="1280" >
....我的“主楼层”画布中有很多子画布项目。子画布对象包含许多路径对象。没有一个比主地板画布的宽度/高度更高或更宽。
<sdk:TabItem Margin="0" Header="Mezzanine">
<Canvas x:Name="Upstairs" HorizontalAlignment="Left" Height="1000" UseLayoutRounding="False" VerticalAlignment="Top" Width="1280">
..另一个选项卡。同样处理子画布对象。
Silverlight project with tabcontrol hosting canvas objects. I want to wrap my entire tabcontrol with a scrollviewer so that on a short display you can scroll vertically to see the whole area on my canvas.
When I run my project my scrollviewer vertical bar is always showing even when there's more room vertically than needed for a scrollbar.
All I am trying to accomplish here is a min resolution of 1280x768 to be scrollable and anything bigger than that have the scrollbars hide. My laptop is only 768 tall, but my canvases were developed with 1280x1024 in mind. So I would like a way to set this up so that everyone can scroll or just see the canvas all at once depending on their resolution.
Anyone have any ideas why it is always visible? I've tried setting canvas width and height. I tried setting stretch on alignments on the outer grid. Saw both those tips while searching other issues similar to mine.
Some code:
<Grid x:Name="LayoutRoot" MinHeight="768" MaxHeight="1024" MinWidth="1024" MaxWidth="1280" Background="#FF6A6868" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.775*"/>
<ColumnDefinition Width="0.225*"/>
</Grid.ColumnDefinitions>
<ScrollViewer VerticalScrollBarVisibility="Auto" MinHeight="768" MaxHeight="1000" MinWidth="1024" MaxWidth="1280" Width="1280" Grid.ColumnSpan="2">
<sdk:TabControl TabStripPlacement="Top" Grid.ColumnSpan="2">
<sdk:TabItem Margin="0" Header="Main Floor">
<Canvas x:Name="Main_Floor" HorizontalAlignment="Left" Height="1024" MinHeight="768" UseLayoutRounding="False" VerticalAlignment="Top" Width="1280" >
....lots of child canvas items in my "Main Floor" canvas. Child canvas objects contain lots of path objects. None which are taller or wider than the main floor canvas width/height.
<sdk:TabItem Margin="0" Header="Mezzanine">
<Canvas x:Name="Upstairs" HorizontalAlignment="Left" Height="1000" UseLayoutRounding="False" VerticalAlignment="Top" Width="1280">
..another tab. Same deal with child canvas objects.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案原来是嵌套在应用程序深处的隐藏高度值。我以困难的方式做了事情,并在我的项目中一点一点地重新创建了每个选项卡,就在那时我找到了它。
感谢 HiTechMagic 的帮助。
solution turned out being a hidden height value nested deep in the application. I did things the hard way and recreated each tab on my project piece by piece and that's when I found it.
Thanks HiTechMagic for your assistance.