scrollviewer 只缩放一个元素
scrollviewer zoom only one element
我必须在 uwp 应用程序中缩放图像,效果很好,但设计要求在它前面有另一个图像(用作按钮),我不希望该元素也被缩放。它必须只是 canvas 标签内的图像,这就是我现在的方式。
<ScrollViewer MinZoomFactor="1"
ZoomMode="Enabled"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto">
<RelativePanel HorizontalAlignment = "Stretch" >
<Canvas x:Name="canvas">
<Image Source = "{Binding Test,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
</Canvas >
<Button RelativePanel.AlignTopWithPanel="True"
Height="55"
Command="{Binding Path=CollapseSplitView}"
CommandParameter="{Binding ElementName=SplitV}">
<Button.Background>
<ImageBrush ImageSource = "/Assets/btlist.png" ></ ImageBrush >
</Button.Background >
</Button >
<Image RelativePanel.AlignBottomWithPanel="True"
RelativePanel.AlignRightWithPanel="True"
Source="/Assets/escala-x.png"
Width="130"
Height="70"
Margin="0,0,20,0"
ScrollViewer.IsZoomChainingEnabled="False"
ScrollViewer.IsZoomInertiaEnabled="False">
</Image>
</RelativePanel>
</ScrollViewer>
这就是我拥有的 xaml,它使缩放适用于其中的所有元素。我尝试为不在 canvas 中但没有运气的元素设置 scrollViewer.zoomMode=disabled。有任何想法吗?谢谢!
我最终通过在 RelativePanel 中添加一个 scrollViewer 来修复它,然后将我想要缩放的内容包装在 StackPanel 中,然后包装在 Grid 中以便能够在其中包含多个元素。谢谢大家
我必须在 uwp 应用程序中缩放图像,效果很好,但设计要求在它前面有另一个图像(用作按钮),我不希望该元素也被缩放。它必须只是 canvas 标签内的图像,这就是我现在的方式。
<ScrollViewer MinZoomFactor="1"
ZoomMode="Enabled"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto">
<RelativePanel HorizontalAlignment = "Stretch" >
<Canvas x:Name="canvas">
<Image Source = "{Binding Test,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
</Canvas >
<Button RelativePanel.AlignTopWithPanel="True"
Height="55"
Command="{Binding Path=CollapseSplitView}"
CommandParameter="{Binding ElementName=SplitV}">
<Button.Background>
<ImageBrush ImageSource = "/Assets/btlist.png" ></ ImageBrush >
</Button.Background >
</Button >
<Image RelativePanel.AlignBottomWithPanel="True"
RelativePanel.AlignRightWithPanel="True"
Source="/Assets/escala-x.png"
Width="130"
Height="70"
Margin="0,0,20,0"
ScrollViewer.IsZoomChainingEnabled="False"
ScrollViewer.IsZoomInertiaEnabled="False">
</Image>
</RelativePanel>
</ScrollViewer>
这就是我拥有的 xaml,它使缩放适用于其中的所有元素。我尝试为不在 canvas 中但没有运气的元素设置 scrollViewer.zoomMode=disabled。有任何想法吗?谢谢!
我最终通过在 RelativePanel 中添加一个 scrollViewer 来修复它,然后将我想要缩放的内容包装在 StackPanel 中,然后包装在 Grid 中以便能够在其中包含多个元素。谢谢大家