For an Attached Property (as opposed to a regular Dependency Property), you will want to implement the Accessors as methods, not a property.
public static void SetTextContent(UIElement element, Object value)
{
element.SetValue(TextContentProperty, value);
}
public static Object GetTextContent(UIElement element)
{
return (Object)element.GetValue(TextContentProperty);
}
As to whether or not you should be using an Attached Property, this link should help you answer that question: http://msdn.microsoft.com/en-us/library/ms749011.aspx[^] Hope this helps, Keith EDIT: You may also want to look at Setting Appropriate Metadata Flags section at http://msdn.microsoft.com/en-us/library/ms753358.aspx[^] in regard to how the control should handle updates to this property.
modified on Monday, July 20, 2009 12:19 PM