Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

  • whoiskb

    whoiskb

    Member

    8 Points

    8 Posts

    First take on a UserControl

    Sep 06, 2007 04:56 AM | LINK

    I am attempting to create my first UserControl and I am getting an error when I view my page in the browser.  The error I get is "ag_e_parser_bad_property_value"

     When I use the UserControl.xaml outside of a user control, it works fine, but when I try to put my user control into my test page and test xaml, I get the error.  Here are the two XAML files I am using and I am curious if you guys could spot what I am doing wrong.

     UserControl.xaml:
    <Canvas
            xmlns="http://schemas.microsoft.com/client/2007"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            x:Name="parentCanvas"
            Width="400"
            Height="40"
            Background="Yellow"
            >
      <Canvas.Resources>
        <Storyboard x:Name="marqueeStoryBoard">
          <DoubleAnimation x:Name="marqueeAnimation" By="1" From="0" Duration="00:00:10" RepeatBehavior="Forever" Storyboard.TargetName="marqueeTextBlock" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" />
        </Storyboard>
      </Canvas.Resources>
      <TextBlock x:Name="marqueeTextBlock" Height="40" Width="400" RenderTransformOrigin="0.5,0.5" FontSize="20" FontWeight="Bold" Text="This is some sample text" >
        <TextBlock.RenderTransform>
          <TransformGroup>
            <TranslateTransform X="0" Y="0"/>
          </TransformGroup>
        </TextBlock.RenderTransform>
      </TextBlock>
    </Canvas>

    And here is my test XAML when I am trying to use the user control:
    <Canvas x:Name="parentCanvas"
            xmlns="http://schemas.microsoft.com/client/2007"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Loaded="Page_Loaded"
            x:Class="Marquee.UserControl;assembly=ClientBin/Marquee.dll"
            Width="640"
            Height="480"
            Background="Gray"
            xmlns:MarqueeUserControl="clr-namespace:Whoiskb;assembly=ClientBin/UserControl.dll"
            >
      <MarqueeUserControl:Marquee x:Name="marquee1"
                                  Text="This is some sample test to see if the namespace works"
                                  Canvas.Top="100" Canvas.Left="20" />
    </Canvas>