Where to put the XML documentation comments for an attached property?
Asked Answered
A

2

6

Assuming I have an attached property defined like that :

    public static string GetMyProperty(DependencyObject obj)
    {
        return (string)obj.GetValue(MyPropertyProperty);
    }

    public static void SetMyProperty(DependencyObject obj, string value)
    {
        obj.SetValue(MyPropertyProperty, value);
    }

    // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty MyPropertyProperty =
        DependencyProperty.RegisterAttached("MyProperty", typeof(string), typeof(MyClass), new UIPropertyMetadata(0));

I can write the documentation for the property identifier (MyPropertyProperty) and for the accessors (GetMyProperty and SetMyProperty), but I have no idea where to put the documentation for MyClass.MyProperty attached property, since it is not an actual code element.

The MSDN library contains such documentation (see for instance Grid.Row), so it must be possible...

Where should I put the XML documentation comments for an attached property ?

Arabella answered 3/8, 2009 at 20:27 Comment(0)
O
3

There's an article about that for Sandcastle:

/// <summary>
/// This defines the <see cref="P:TestDoc.TestClass.IsBroughtIntoViewWhenSelected"/>
/// attached property.
/// </summary>
///
/// <AttachedPropertyComments>
/// <summary>This attached property indicates whether or not a tree view item is
/// brought into view when selected.
/// </summary>
/// <value>The default value is false</value>
/// </AttachedPropertyComments>
public static readonly DependencyProperty IsBroughtIntoViewWhenSelectedProperty =
    DependencyProperty.RegisterAttached("IsBroughtIntoViewWhenSelected",
typeof(bool), typeof(TestClass),
new UIPropertyMetadata(false, OnIsBroughtIntoViewWhenSelectedChanged));
Oecology answered 3/8, 2009 at 20:37 Comment(1)
Link-only answer with broken link.Translucid
D
1

Even though the answer is a bit late I have found a solution for the appearance of the documentation during runtime of Visual Studio.

If you use ReSharper and press CTRLQ then the XML-Documentation that is added above the SetXXX-method is used to show for the Quick-Documentation.

Downward answered 23/2, 2016 at 8:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.