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)));
        }
    }
}
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,670 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,600 questions
{count} vote