Hiding the WPF Control Property from the Designer (Visual Studio 2010)

I am using Visual Studio 2010 and WPF.

I am creating a new control that inherits ContentControl, and I want to hide the Content property so that it is not visible in the Properties window at design time.

I tried using

[Browsable(false)]

as in WinForms, but it does not work.

Any idea on how to solve this problem?

Thank.

+5
source share
1 answer

Michelle

Your property must be publicly available:

[Browsable(false)]
public new object Content
{
    get { return base.Content; }
    set { base.Content = value; }
}

Once you set it up for sharing, it will be hidden in the properties window.

With private:

enter image description here

With publication:

enter image description here

thank

+6
source

All Articles