c# – scrollviewer只缩放一个元素
作者:互联网
我必须在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,它使缩放适用于其中的所有元素.我试图为不在画布中但没有运气的元素设置scrollViewer.zoomMode = disabled.有任何想法吗?谢谢!
解决方法:
我最后通过在RelativePanel中添加一个scrollViewer来修复它,然后将我想要缩放的内容包装在StackPanel中,然后将Grid包含在内部的多个元素中.谢谢大家
标签:c,xaml,scrollview,uwp,uwp-xaml 来源: https://codeday.me/bug/20190522/1153945.html