相关疑难解决方法(0)

无法在样式设置器上设置TargetName属性,那么它是如何设置的?

过去一周我一直在探索WPF,所以这对我来说还是一个新手.我正在研究的一件事是简单的动画.在这种情况下,一个弹跳的笑脸.

我的攻击计划是:

  1. 做个笑脸.我做到了这一点.
  2. 在一个简单的对象上计算出弹跳动画.我做到了这一点.
  3. 摘要那个动画可以在几个地方使用(笑脸的元素).我被困在这里
  4. 将抽象的动画样式应用于笑脸的所有元素.

在第2步之后,我进行了以下工作XAML:

<Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApplication1"
        mc:Ignorable="d"
        Title="Test Window" Height="350" Width="620">
    <Grid>
        <Canvas Margin="0,180,0,0">
            <Ellipse Canvas.Left="10" Canvas.Top="10" Width="100" Height="100" Stroke="Blue" StrokeThickness="4" Fill="Aqua" />
            <Ellipse Canvas.Left="30" Canvas.Top="12" Width="60" Height="30">
                <Ellipse.Fill>
                    <LinearGradientBrush StartPoint="0.45,0" EndPoint="0.5, 0.9">
                        <GradientStop Offset="0.2" Color="DarkMagenta" />
                        <GradientStop Offset="0.7" Color="Transparent" />
                    </LinearGradientBrush>
                </Ellipse.Fill>
            </Ellipse>
            <Ellipse Canvas.Left="33" Canvas.Top="35" Width="20" Height="20" Stroke="Blue" StrokeThickness="3" Fill="White" />
            <Ellipse Canvas.Left="40" Canvas.Top="43" Width="6" Height="5" Fill="Black" />
            <Ellipse Canvas.Left="68" Canvas.Top="35" Width="20" Height="20" Stroke="Blue" StrokeThickness="3" Fill="White" />
            <Ellipse Canvas.Left="75" Canvas.Top="43" …
Run Code Online (Sandbox Code Playgroud)

.net c# wpf animation xaml

12
推荐指数
2
解决办法
8972
查看次数

标签 统计

.net ×1

animation ×1

c# ×1

wpf ×1

xaml ×1