0
無法理解爲什麼Translatetransform
綁定不起作用。我有3個滑塊 - 一個用於縮放,另外兩個用於x和y轉換(我的圓圈代碼爲Canvas
的子元素)。TranslateTransform與滑塊綁定不起作用
我使用下面的XAML:
<Window x:Class="Visualizer.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" WindowState="Maximized" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
<Canvas HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Name="MainCanvas" >
<Canvas HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Name="OperatorsCanvas" >
<ContentControl x:Name="OperatorsContent"/>
<Canvas.LayoutTransform>
<TransformGroup>
<ScaleTransform
CenterX="0"
CenterY="0"
ScaleX="{Binding ElementName=ScaleSlider,Path=Value}"
ScaleY="{Binding ElementName=ScaleSlider,Path=Value}"
/>
<TranslateTransform X="{Binding ElementName=TranslateXSlider,Path=Value}" Y="{Binding ElementName=TranslateYSlider,Path=Value}" />
</TransformGroup>
</Canvas.LayoutTransform>
</Canvas>
<Slider Canvas.Right="5" Width="154" Canvas.Top="5" HorizontalAlignment="Right" Name="ScaleSlider" ToolTip="Determines the UI scale factor."
Value="1" Minimum="0.1" Maximum="4"/>
<Slider Canvas.Bottom="0" Width="762" HorizontalAlignment="Stretch" Name="TranslateXSlider" Value="0" Minimum="-20" Maximum="20"/>
<Slider Canvas.Right="0" Canvas.Top="282" Width="423" RenderTransformOrigin="0.494,0.455" Height="16" Name="TranslateYSlider" Value="0" Minimum="-20" Maximum="20" >
<Slider.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="90"/>
<TranslateTransform/>
</TransformGroup>
</Slider.RenderTransform>
</Slider>
</Canvas>
</Window>
縮放的作品,但改造不會。