MartinZPetrov
MartinZPetrov

Reputation: 316

Transferring user control from one project to other

I have to following user control in one project.

<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>

In the project from where I copy the code it compiles and works perfectly but when transferring to another project I get the erros:

"Error 4 The attachable property 'Fill' was not found in type 'Arc'"

Error 1 The name "Arc" does not exist in the namespace "http://schemas.microsoft.com/expression/2010/drawing".

What am doing wrong what am I missing got stuck here...

Upvotes: 0

Views: 344

Answers (1)

tgpdyk
tgpdyk

Reputation: 1233

'Copy-pasting' a UserControl's code from one project to another requires the target project to be the same as the source's assembly/binary references.

In your case, you need to reference Microsoft.Expression.Drawing assembly to your target project.

Upvotes: 1

Related Questions