Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 ?

like image 896
Thomas Levesque Avatar asked Aug 03 '09 20:08

Thomas Levesque


2 Answers

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));
like image 143
Kenan E. K. Avatar answered Sep 21 '22 00:09

Kenan E. K.


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.

like image 22
Michael Mairegger Avatar answered Sep 20 '22 00:09

Michael Mairegger