本文介绍了如何处理DataTemplate中的控件(即surfaceScrollViewer)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在scatterViewItem datatemplate中访问控件时出现问题。


例如,

< DataTemplate x:Key =" UndergraduateInfoTemplate"> 
< Grid>
< Rectangle Fill =" White"余量= QUOT; -1,-1,0,0"半径Y = QUOT; 22.5"半径X = QUOT; 22.5" Grid.RowSpan = QUOT; 2英寸/>
< Grid Margin =" 20">
< Grid.RowDefinitions>
< RowDefinition Height =" 30" />
< RowDefinition Height =" 70" />
< RowDefinition Height =" *" />
< /Grid.RowDefinitions>
< TextBlock Grid.Row =" 0"前景= QUOT;#FF2767AF" Text =" {Binding ProgrammeName}"的FontFamily = QUOT;宋体"字号= QUOT 18 QUOT; fontWeight设置= QUOT;粗体" />
< TextBlock Grid.Row =" 1" TextWrapping = QUOT;包覆与QUOT; Text =" {Binding ProgrammeIntro}"前景= QUOT;#FF605D5D"的FontFamily = QUOT;宋体"字号= QUOT; 14'; />
< s:SurfaceScrollViewer Grid.Row =" 2" Horizo​​ntalScrollBarVisibility = QUOT;禁用" Style =" {DynamicResource SurfaceScrollViewerStyle}"余量= QUOT; 0" CanContentScroll = QUOT;真">
< TextBlock Margin =" 0"前景= QUOT;黑色"的FontFamily = QUOT;宋体" TextWrapping = QUOT;包覆与QUOT; Text =" {Binding ProgrammeContent}" />
< / s:SurfaceScrollViewer>
< / Grid>
< / Grid>
将/ DataTemplate中>




当我触摸的ScrollViewer,它可以检测目标源是的ScrollViewer,但滚动是不起作用(只适用于滚动条,内容滚动不起作用)。


奇怪的是,如果我直接创建没有模板的scatterviewitem,它可以正常工作。



请有人帮帮我吗?


非常感谢。


弗兰克

解决方案


Hi,

I got problem with accessing the control within a scatterViewItem datatemplate.

for example,

<DataTemplate x:Key="UndergraduateInfoTemplate">
			<Grid>
				<Rectangle Fill="White" Margin="-1,-1,0,0" RadiusY="22.5" RadiusX="22.5" Grid.RowSpan="2"/>
				<Grid Margin="20">
					<Grid.RowDefinitions>
						<RowDefinition Height="30"/>
						<RowDefinition Height="70"/>
						<RowDefinition Height="*"/>
					</Grid.RowDefinitions>
					<TextBlock Grid.Row="0" Foreground="#FF2767AF" Text="{Binding ProgrammeName}" FontFamily="Calibri" FontSize="18" FontWeight="Bold"/>
					<TextBlock Grid.Row="1" TextWrapping="Wrap" Text="{Binding ProgrammeIntro}" Foreground="#FF605D5D" FontFamily="Calibri" FontSize="14"/>
					<s:SurfaceScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Disabled" Style="{DynamicResource SurfaceScrollViewerStyle}" Margin="0" CanContentScroll="True">						
						<TextBlock Margin="0" Foreground="Black" FontFamily="Calibri" TextWrapping="Wrap" Text="{Binding ProgrammeContent}"/>
					</s:SurfaceScrollViewer>
				</Grid>
			</Grid>
		</DataTemplate>

when I touch the scrollviewer, it can detect the target source is scrollviewer, but the scroll is not work (only works with the scroll bar, the content scroll not work).

The strange part is if I create the scatterviewitem directly without template, it works fine.

Can anybody give me a hand, please?

Many thanks.

Frank

解决方案


这篇关于如何处理DataTemplate中的控件(即surfaceScrollViewer)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 06:23