【发布时间】:2012-03-22 21:58:12
【问题描述】:
我需要创建一个故事板,在其中更改图像控件的 ImageSource 以使其更流畅,但我不知道如何执行此操作,因为我是故事板的新手。
有人可以解释一下如何做到这一点吗?
这是我的 XAML: (CenterScaleImage 只是一个带有 2 个额外属性的 Image-ctrl)
<Grid x:Name="LayoutRoot" DataContext="{Binding Main, Mode=OneWay, Source={StaticResource Locator}}" Background="White">
<Controls:CenterScaleImage x:Name="Image" Margin="0" Source="{Binding PropVisibleImage}" ScaleFactor="{Binding PropScaleFactor}" CenterScaleX="{Binding PropScaleCenterX}" CenterScaleY="{Binding PropScaleCenterY}">
<Controls:CenterScaleImage.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleY="{Binding PropScaleFactor}" ScaleX="{Binding PropScaleFactor}" CenterX="{Binding PropScaleCenterX}" CenterY="{Binding PropScaleCenterY}"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform X="{Binding PropPanHorizontal}" Y="{Binding PropPanVertical}"/>
</TransformGroup>
</Controls:CenterScaleImage.RenderTransform>
</Controls:CenterScaleImage>
</Grid>
【问题讨论】:
-
从 MSDN 阅读 this guide
-
@milter thx 但我需要在代码隐藏中进行。
标签: c# wpf image xaml storyboard