Silverlight 业务应用程序 - 应用程序内的导航/样式
比什么都更好奇,但我想知道是否有人知道为什么此模板中的滚动查看器以这种方式配置:
<!-- Page ScrollViewer Style -->
<Style x:Key="PageScrollViewerStyle" TargetType="ScrollViewer">
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0,1,0,1"/>
<Setter Property="Margin" Value="-58,-5,-58,-5"/>
<Setter Property="Padding" Value="35,-10,33,-10"/>
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Auto"/>
我特别想知道 Margin 和 Padding 属性。这里正在完成什么,而不仅仅是允许 ScrollViewer 包含在父对象中?
More curious than anything, but I'm wondering if anybody knows why this the scrollviewer in this template is configured in this way:
<!-- Page ScrollViewer Style -->
<Style x:Key="PageScrollViewerStyle" TargetType="ScrollViewer">
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0,1,0,1"/>
<Setter Property="Margin" Value="-58,-5,-58,-5"/>
<Setter Property="Padding" Value="35,-10,33,-10"/>
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Auto"/>
In particular I'm wondering about the Margin, and Padding attributes. What is is being accomplished here, rather than just allow the ScrollViewer to be contained within the parent object?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
把它拿出来看看会发生什么。
没有充分的理由在样式中执行此操作,因为它将隐式应用于所有 ScrollViewer 控件。然而,我注意到 Silverlight 中的 ScrollViewers 有奇怪的表现行为。有时,滚动条部分会绘制在父容器的外部和上方。由于这个原因,我之前不得不填充 ScrollViewer 的边距。查看器的内容将在父级中正确显示,但滚动条本身将溢出右边缘。
不管怎样,如果你删除它并且一切看起来都很好,那就把它留下吧。
Take it out and see what happens.
There isn't a good reason to do that in a style because it will apply to all ScrollViewer controls implicitly. I have noticed, however, that ScrollViewers in Silverlight have strange presentation behavior. Sometimes the scrollbar portion will draw outside and over the parent container. I've had to pad the margins of a ScrollViewer before because of this very reason. The content of the viewer will be correctly framed in the parent but the scroll bars themselves will overflow the right edge.
Anyway, if you remove it and everything looks fine, leave it out.
来自 MSDN:
From MSDN: