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 ?
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));
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With