将用户控制权从一个项目转移到另一个项目

问题描述 投票:0回答:1

我必须在一个项目中遵循用户控制。

<UserControl x:Class="Support.Throbber"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
         xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
         xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
         mc:Ignorable="d" 
         d:DesignHeight="40" d:DesignWidth="40"
         >
<UserControl.Resources>

    <Storyboard x:Key="SpinIt">
        <DoubleAnimationUsingKeyFrames 
            Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)"
            RepeatBehavior="30x"
            Storyboard.TargetName="ArcContainer">
            <EasingDoubleKeyFrame KeyTime="0:0:1" Value="360"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>

</UserControl.Resources>
<UserControl.Triggers>
    <EventTrigger RoutedEvent="UIElement.GotFocus" SourceName="ArcContainer">
        <BeginStoryboard Storyboard="{StaticResource SpinIt}"/>
    </EventTrigger>
</UserControl.Triggers>

<Grid Height="40" Width="40">
    <ContentControl x:Name="ArcContainer" RenderTransformOrigin="0.5,0.5">
        <ContentControl.RenderTransform>
            <TransformGroup>
                <ScaleTransform/>
                <SkewTransform/>
                <RotateTransform/>
                <TranslateTransform/>
            </TransformGroup>
        </ContentControl.RenderTransform>
        <ContentControl.Template>
            <ControlTemplate TargetType="{x:Type ContentControl}">
                <ed:Arc x:Name="arc" ArcThickness="8" 
                    EndAngle="380" Height="40" Stretch="None"
                    StartAngle="200" UseLayoutRounding="False" Width="40" 
                    RenderTransformOrigin="0.5,0.5">
                    <ed:Arc.Fill>
                        <LinearGradientBrush EndPoint="0.5,.85" StartPoint="0.5,0">
                            <GradientStop Color="CadetBlue"/>
                            <GradientStop Color="White" Offset="1"/>
                        </LinearGradientBrush>
                    </ed:Arc.Fill>
                </ed:Arc>
            </ControlTemplate>
        </ContentControl.Template>
    </ContentControl>
</Grid>

在我从中复制代码的项目中,它可以编译并正常运行,但是当转移到另一个项目时,会出现错误:

“错误4在类型'Arc'中找不到可附加的属性'Fill'”

错误1名称空间“ http://schemas.microsoft.com/expression/2010/drawing”中不存在名称“ Arc”。

做错了我想念的东西卡在这里...

c# wpf user-controls
1个回答
1
投票

将用户控件的代码从一个项目复制粘贴到另一个项目时,要求目标项目与源项目的汇编/二进制引用相同。

在您的情况下,您需要将Microsoft.Expression.Drawing程序集引用到目标项目。

© www.soinside.com 2019 - 2024. All rights reserved.