WPF user control property appears not empty in Visual Studio XAML Properties toolbar
Hello
I'm creating a WPF custom Button Control inheriting from System.Windows.Controls.Button.
using System.ComponentModel;
using System.Windows.Controls;
namespace BMCustomer
{
public class MyButton : Button
{
[Category("MyCategory")]
[Description("Description for MyText property")]
//[DefaultValue(null)]
[DefaultValue("")]
public string MyText { get; set; }
//public string MyText
//{
// get { return (string)GetValue(MyTextProperty); }
// set { SetValue(MyTextProperty, value); }
//}
//public static readonly System.Windows.DependencyProperty MyTextProperty =
// System.Windows.DependencyProperty.Register("MyText", typeof(string), typeof(MyButton),
// new System.Windows.FrameworkPropertyMetadata(null));
}
}
When I use MyButton in an XAML and select the Control, the Properties toolbox displays "MyText" property as "MyText" instead of empty. But ContentStringFormat, that is also a string property of the inherited Button, is displayed as empty. See below the image of Visual Studio.
I tried a lot of combinations for this property to be displayed empty with no success: making a DependecyProperty, using DefaultAttribute ...
How can I make this property to be displayed blank when no used?
Thank you in advance