© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2w ago
ACiDCA7

xaml designer extension: how to access attached properties

visual studioidewpf
im currently trying to extend the xaml designer to make some tasks easier. sadly i came to a roadblock, i have no clue how to properly access and modify attached properties. Documentation is barely existent, the only stuff i found was
- https://github.com/microsoft/xaml-designer-extensibility
- https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/bb546938(v=vs.100) (really old)

i have the *.DesignTools running, a Adorner pops up in the designer and the associated methods gets executed.

for testing im just using a Canvas that contains my control with set Canvas.Left/Canvas.Top

metadata looks like this in case its relevant (its all of it, i only omitted usings)

[assembly: ProvideMetadata(typeof(TestControls.DesignTools.Metadata))]
namespace TestControls.DesignTools
{
    internal class Metadata : IProvideAttributeTable
    {
        public AttributeTable AttributeTable
        {
            get
            {
                AttributeTableBuilder builder = new AttributeTableBuilder();

                builder.AddCustomAttributes("TestControls.CustomControl1", new FeatureAttribute(typeof(AdornerProvider)));

                return builder.CreateTable();
            }
        }
    }
}
[assembly: ProvideMetadata(typeof(TestControls.DesignTools.Metadata))]
namespace TestControls.DesignTools
{
    internal class Metadata : IProvideAttributeTable
    {
        public AttributeTable AttributeTable
        {
            get
            {
                AttributeTableBuilder builder = new AttributeTableBuilder();

                builder.AddCustomAttributes("TestControls.CustomControl1", new FeatureAttribute(typeof(AdornerProvider)));

                return builder.CreateTable();
            }
        }
    }
}


i dont think the AdornerProvider contains anything relevant to this question, it is more or less a copy of https://github.com/microsoft/xaml-designer-extensibility/blob/main/samples/CustomControlLibrary.WpfCore/CustomControlLibrary.WpfCore.DesignTools/OpacitySliderAdornerProvider.cs

i asumed the attached property would like the other properties appear in adornedControlModel.Properties but nope. which i find strange since all collectionitems have properties for IsSet/IsAttached. IsSet is properly set when these properties are set locally(in xaml)

im already bashing my head through this problem a couple of days and couldnt find a satisfying solution.

i hope someone here can bring me on the right track
GitHub
GitHub - microsoft/xaml-designer-extensibility: Extensibility sampl...
Extensibility sample code for the Visual Studio XAML Designer - microsoft/xaml-designer-extensibility
GitHub - microsoft/xaml-designer-extensibility: Extensibility sampl...
WPF Designer Extensibility
WPF Designer Extensibility
GitHub
xaml-designer-extensibility/samples/CustomControlLibrary.WpfCore/Cu...
Extensibility sample code for the Visual Studio XAML Designer - microsoft/xaml-designer-extensibility
xaml-designer-extensibility/samples/CustomControlLibrary.WpfCore/Cu...
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

✅ WPF XAML Designer
C#CC# / help
3y ago
❔ XAML Designer WPF
C#CC# / help
3y ago
❔ ✅ cannot get xaml designer to show in visual studio
C#CC# / help
3y ago