Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7727209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:24:09+00:00 2026-06-01T05:24:09+00:00

I have the following property definition: public static class Extensions { public static readonly

  • 0

I have the following property definition:

public static class Extensions
{
    public static readonly DependencyProperty TestProperty = DependencyProperty.RegisterAttached("Test", typeof(Storyboard), typeof(UIElement), new UIPropertyMetadata(null));

    public static void SetTest(UIElement element, Storyboard value)
    {
         element.SetValue(TestProperty, value);
    }

    public static Storyboard GetTest(UIElement element)
    {
         return (Storyboard)element.GetValue(TestProperty);
    }
}

And try it use in the xaml

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Application;assembly=Application"
    x:Name="template"
    Height="40" Width="1460">
    <Grid Background="#FF000000">
        <TextBlock Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Left" TextAlignment="Left" FontSize="32">Example</TextBlock>
    </Grid>
    <UserControl.Style>
        <Style>
            <Setter Property="local:Extensions.Test">
                <Setter.Value>
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetName="template" From="270" To="360" Duration="0:0:1" Storyboard.TargetProperty="Angle" />
                    </Storyboard>
                </Setter.Value>
            </Setter>
         </Style>
    </UserControl.Style>
</UserControl>

when i try to load such xaml (for example using XamlReader.Load(stream);), i get the exception with the following message

‘local:Extensions.Test’ property is not a valid DependencyProperty on the type ‘Application.Extensions’. Verify that the property has a DependencyProperty defined with a member field that ends with the ‘Property’ suffix. Error at object ‘System.Windows.Setter’.

Can anybody help me with this problem?

thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:24:10+00:00Added an answer on June 1, 2026 at 5:24 am

    The owner type should be Extensions instead of UIElement:

    public static readonly DependencyProperty TestProperty =
        DependencyProperty.RegisterAttached(
            "Test",
            typeof(Storyboard),
            typeof(Extensions), // here
            new UIPropertyMetadata(null)); 
    

    Could also be written without metadata:

    public static readonly DependencyProperty TestProperty =
        DependencyProperty.RegisterAttached(
            "Test",
            typeof(Storyboard),
            typeof(Extensions)); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following dependency property inside a class: class FooHolder { public static
I am using the XmlSerializer and have the following property in a class public
i have the following property declaration Public Property IsAreaSelected() As Integer Get Return If(ViewState(IsAreaSelected)
I have the following property public MyType MyProperty {get;set;} I want to change this
I have following simple class: @interface Article: NSObject { NSString *title; } @property (copy,
I have following event class. I have a question related to the Property method
I have the following definitions. interface IWeapon {} class Warrior { [Inject] public IEnumerable<IWeapon>
I have got the following interface definition: public interface ICommandHandler { ILogger Logger {
I have an Entity with the following property: [ScriptIgnore] public DateTime Date { get
Here is my problem in C# : I have the following classes: public class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.