[英]GridView gets tapped in WinRT Xaml
I am using GridView
inside SemanticZoom
in my WinRT xaml
to display set of images in it. 我在
WinRT xaml
SemanticZoom
中使用GridView
在其中显示图像集。
The code I am using is as below 我正在使用的代码如下
<SemanticZoom>
<SemanticZoom.ZoomedInView>
<GridView>
<ScrollViewer Name="canvas" Height="500" Background="Red" Margin="288,135,222,133">
<ItemsControl>
<Image Name="img1" Height="577" Canvas.Left="145" Canvas.Top="65" Width="608" Source="Assets/issue mentioned.png" Visibility="Visible"/>
<Image Name="img2" Height="577" Canvas.Left="154" Canvas.Top="650" Width="608" Source="Assets/issue mentioned.png" Visibility="Visible"/>
</ItemsControl>
</ScrollViewer>
</GridView>
</SemanticZoom.ZoomedInView>
</SemanticZoom>
The images
are displayed correctly when I run the application. 当我运行应用程序时,
images
会正确显示。 When I touch the images, it gets tapped. 当我触摸图像时,它会被点击。 How to get rid of this?.
如何摆脱这个? I don't need that to be getting tapped.
我不需要被利用。
We can remove the tap visual effect from Grid View by removing the pressed state animation from ItemContainerStyle like below. 我们可以通过从ItemContainerStyle中删除按下状态的动画来从Grid View中删除水龙头视觉效果,如下所示。
<Style x:Key="GridViewItemsStyle" TargetType="GridViewItem">
<Setter Property="HorizontalAlignment" Value="right"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GridViewItem">
<Border x:Name="OuterContainer">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="PointerOver"/>
<VisualState x:Name="Pressed"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid x:Name="ReorderHintContent" Background="Transparent">
<Border x:Name="ContentContainer">
<Grid>
<Border x:Name="ContentBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<ContentPresenter x:Name="contentPresenter" ContentTransitions="{TemplateBinding ContentTransitions}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" />
</Border>
</Grid>
</Border>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<GridView ItemContainerStyle="{StaticResource GridViewItemsStyle}"
SelectionMode="None">
<ScrollViewer Name="canvas"
Height="500"
Background="Red"
Margin="288,135,222,133">
<ItemsControl>
<Image Name="img1"
Height="577"
Width="608"
Source="Assets/ShowPlaceholder.png"
Visibility="Visible" />
<Image Name="img2"
Height="577"
Width="608"
Source="Assets/ShowPlaceholder.png"
Visibility="Visible" />
</ItemsControl>
</ScrollViewer>
</GridView>
I hope this will help you. 我希望这能帮到您。
Santyy 桑蒂
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.