本文介绍了WPF 和 ToolboxItem(false)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在控件库中的几个类上设置 ToolboxItem(false) 属性,以防止将其添加到 Toolbox.此属性在 ASP.NET 设计器中非常有效,但在 WPF 设计器中似乎不起作用.

I'm setting ToolboxItem(false) attribute on couple of classes in my control library to prevent the from being added to Toolbox. This attribute works perfectly well with ASP.NET designer but with WPF designer it seems to have no effect.

是否有其他方法可以使用 WPF 实现此目的,或者只是不受支持?

Is there some other way to achieve this with WPF or is just unsupported?

推荐答案

我自己找到了答案.您应该使用 ToolboxBrowsable(false) 属性来自Microsoft.Windows.Design 命名空间,而不是 System.ComponentModel 中的 ToolboxItem(false).

Found the answer myself. You should use ToolboxBrowsable(false) attribute from Microsoft.Windows.Design namespace rather than ToolboxItem(false) from System.ComponentModel.

这篇关于WPF 和 ToolboxItem(false)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 03:32