Control are visible in VisualStudio 2022 ToolBox even after DesignTimeVisible attribute as false.

SaranRaj Chandrasekaran 5 Reputation points
2023-03-28T13:27:45.1766667+00:00

In VS 2022, I have a Custom Control Library, When adding the Custom Control to WPF ToolBox the controls are visible even after adding the following attribute "[Browsable(false), EditorBrowsable(EditorBrowsableState.Never), ToolboxItem(false), DesignTimeVisible(false)]". If I use the "DesignTimeVisible(false)" attribute at first "[DesignTimeVisible(false), Browsable(false), EditorBrowsable(EditorBrowsableState.Never), ToolboxItem(false)]" in this format it works.

But In VS 2019, it supports all the formats have no issues.

Is there any solution to support all formats in VS 2022?

Attached Custom Control Library sample code here.

namespace WpfCustomControlLibrary
{   

    [DesignTimeVisible(false), Browsable(false), EditorBrowsable(EditorBrowsableState.Never), ToolboxItem(false)]
     
    public class CustomControl1 : Control
    {
        static CustomControl1()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomControl1), new FrameworkPropertyMetadata(typeof(CustomControl1)));
        }
    }
}
Developer technologies | Windows Presentation Foundation
Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other
A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
{count} vote

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.