如何在surfacescrollviewer中显示滚动条? [英] how to display a scrollbar in a surfacescrollviewer?

查看:67
本文介绍了如何在surfacescrollviewer中显示滚动条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ScrollViewer,我想显示滚动条。我试图改变属性Horizo​​ntalScrollBarVisibility =" Visible"但它失败了。非常感谢。



$

I have a ScrollViewer and I want to display the scrollbar. I was trying to change the property HorizontalScrollBarVisibility = "Visible" but it failed. thank you very much.



推荐答案

为了让滚动条显示滚动条,您需要验证是否指定了小于内容的宽度值。

如果未指定此宽度值,则为不会显示。

in order to get a scrollbar appearing for your scrolviewer, you need to verifiy that you have specify a Width value which is smaller than you content.
If you do not specify this width value, it will not show.

如果你垂直滚动那么它就是你需要设置高度值的对立面;

If you scroll vertically then it is the opposit you need to set the Height value instead;

这是一个示例:

<s:SurfaceScrollViewer x:Name="_mainHScrollViewer" ScrollChanged="_mainHScrollViewer_ScrollChanged" Margin="0,0,0,20" Style="{StaticResource SurfaceScrollViewerStyle}" Grid.Row="1" Width="{Binding ElementName=main, Path=Width}" PanningMode="HorizontalOnly" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">

            <StackPanel x:Name="propertyDetailItemInfo" Margin="2,0,2,5" Orientation="Horizontal" Grid.Row="1" Background="Transparent" >
                
                <controls:ResumeControl DataContext="{Binding}" />
                <controls:KeyFeatureControl DataContext="{Binding}" Margin="30,0,0,0" Visibility="{Binding HasKeyFeature,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource VisibilityConverter}}"/>
                <controls:DescriptionControl DataContext="{Binding}" Margin="30,0,0,0"/>
                <controls:EnergyControl DataContext="{Binding}" Margin="30,0,0,0" Visibility="{Binding HasEnergyPerformance,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource VisibilityConverter}}"/>
                <controls:PlanControl DataContext="{Binding}" Margin="30,0,0,0" Visibility="{Binding HasPlan,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource VisibilityConverter}}"/>
                <controls:PictureControl DataContext="{Binding}" Margin="30,0,0,0"/>
            </StackPanel>

        </s:SurfaceScrollViewer>

在此示例中,Width绑定到用户控件的宽度。

In this sample the Width is bind to teh Width of a user control.

我还发布了一个嵌套scroolviewer交互的样本

I have also post a sample with nested scroolviewer interaction

http://code.msdn.microsoft.com/Sample-Nested-ScrollViewer-5c0c1266

希望有帮助。
感谢mark作为答案,如果它对其他人有帮助

Hope it helps
Thanks to mark as answer if it helps for others

问候

哔叽


这篇关于如何在surfacescrollviewer中显示滚动条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆