XAMLの記述

タグの編集
投稿者 名無しの権兵衛  (小学生) 投稿日時 2013/5/8 17:53:06
下のコードを記述したいのですが、XAMLのどこに記述すれば良いですか?
 <BeginStoryboard>
        <Storyboard>
            <MatrixAnimtionUsingPath Duration="0:0:3" Storyboard.TargetNeme="Rectengle1" Storyboard.TagetProperty="RenderTransform.Matrix">
                <MatrixAnimationUsingPath.PathGeometry>
                    <PathGeometry>
                        <PathGemetry.Figures>
                            <PathFigures>
                                <PathFigure StaratPoint="0,0">
                                    <ArcSegment Point="0.1,0" Size="200,200" IsLargeArc="true" />
                                </PathFigure>
                            </PathFigures>
                        </PathGemetry.Figures>
                    </PathGeometry>
                </MatrixAnimationUsingPath.PathGeometry>
            </MatrixAnimtionUsingPath>
        </Storyboard>
    </BeginStoryboard>
投稿者 YuO  (社会人) 投稿日時 2013/5/8 19:00:53
対象となるTriggerの中だと思いますが……。

http://ufcpp.net/study/dotnet/wpf_xamlani.html
とか
http://blogs.wankuma.com/kazuki/archive/2008/09/25/157453.aspx
とかが参考になるかと。
投稿者 るきお  (社会人) 投稿日時 2013/5/8 19:13:25
こんな感じでわかるでしょうか?
この例ではRectangleのEventTriggerの中に書いています。
Rectangleをクリックするとくるっと動きます。

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Rectangle Fill="#FFFF4444" Width="100" Height="100">
            <Rectangle.Triggers>
                <EventTrigger RoutedEvent="MouseUp">
                    <BeginStoryboard>
                        <Storyboard>
                            <MatrixAnimationUsingPath Duration="0:0:3" Storyboard.TargetProperty="RenderTransform.Matrix">
                                <MatrixAnimationUsingPath.PathGeometry>
                                    <PathGeometry>
                                        <PathGeometry.Figures>                                  
                                            <PathFigure StartPoint="0,0">
                                                <ArcSegment Point="0.1,0" Size="200,200" IsLargeArc="true" />
                                            </PathFigure>                             
                                        </PathGeometry.Figures>
                                    </PathGeometry>
                                </MatrixAnimationUsingPath.PathGeometry>
                            </MatrixAnimationUsingPath>
                        </Storyboard>
                    </BeginStoryboard>

                </EventTrigger>
            </Rectangle.Triggers>
        </Rectangle>
    </Grid>
</Window>


記述の間違いがいろいろありましたので、訂正しています。