开发者

How can I get Browsable(false) to actually hide the property in the IDE

Good Afternoon,

I've created a user-defined component that has a boolean property. I would like Visual studio do NOT SHOW it on the property Window. I've googled ex开发者_如何学Gotensively and the consensus seems to be to try to use the Browsable/BrowsableAttribute property descriptors.

Visual Studio appears to be ignoring this attribute altogether. I've tried building all my projects, resetting the toolbox to no avail. Please help.

Thanks and regards, -Alan.

[Browsable(false)]  // I have also tried [BrowsableAttribute(false)]
public bool IsBusy
{
    get
    {
        return _isBusy;
    }
    set
    {
        throw new InvalidOperationException("");
    }
}


It really is [Browsable]. Omitting the setter would be another way, that makes sense in this scenario.

I'm guessing the real problem you have is an old copy of this control stored in the toolbox assembly folder. Such a copy is made if you add the control to the toolbox yourself with Choose Items, Browse tab. You might be updating your local copy but not the toolbox version.

I need to wave my hands at this a bit, I know it can happen but never discovered how it happens. This never went wrong for me personally, but I always make sure to let the toolbox auto-populate itself instead of adding the control explicitly. If you did add it like this then start by removing it. Right-click the item in the toolbox and select Delete. The copy is stored in c:\users\yourname\appdata\local\microsoft\visualstudio\x.x\projectassemblies

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜