今天自己做了个频道导航。原来的pivot控件不好,不能平滑的滚动,只能顺序的切换,这样的话如果我现在是第一个频道,想到频道三去就必定要先切换到品频道二,这样显然体验不好。于是用scrollviewer做了个导航控件,这样的话就是平滑滑动了。双击选中!见图:
双击频道切换到导航状态,双击选中又回到初始状态。
下面说说scrollviewer:
<
ScrollViewer Visibility
=
"
Collapsed
"
VerticalContentAlignment
=
"
Center
"
HorizontalScrollBarVisibility
=
"
Hidden
"
x:Name
=
"
channel
"
>
< StackPanel x:Name = " sp " Orientation = " Horizontal " HorizontalAlignment = " Left " VerticalAlignment = " Center " >
< TextBlock Text = " 华语 " Foreground = " White " TextAlignment = " Center " FontSize = " 45 " Width = " 100 " DoubleTap = " TextBlock_DoubleTap " />
< TextBlock Text = " 欧美 " FontSize = " 40 " TextAlignment = " Center " Foreground = " #FFC2BABA " Width = " 100 " DoubleTap = " TextBlock_DoubleTap " />
。。。。。。。。。。。。。。。。。。。。。。。。。。。
</ StackPanel >
< StackPanel x:Name = " sp " Orientation = " Horizontal " HorizontalAlignment = " Left " VerticalAlignment = " Center " >
< TextBlock Text = " 华语 " Foreground = " White " TextAlignment = " Center " FontSize = " 45 " Width = " 100 " DoubleTap = " TextBlock_DoubleTap " />
< TextBlock Text = " 欧美 " FontSize = " 40 " TextAlignment = " Center " Foreground = " #FFC2BABA " Width = " 100 " DoubleTap = " TextBlock_DoubleTap " />
。。。。。。。。。。。。。。。。。。。。。。。。。。。
</ StackPanel >
</ScrollViewer>
注意:
HorizontalScrollBarVisibility="Hidden"这里你一定要给这个属性赋值,当然不能是Disabled。默认状态下是不能滑动的。