How to put a UserControl into Visual Studio toolBox

前端 未结 10 2180
逝去的感伤
逝去的感伤 2020-11-29 01:02

I made a usercontrol in my project, and after building project, I need to put it in my toolbox, and use it as a common control. but i can\'t. the UserControl is

10条回答
  •  渐次进展
    2020-11-29 01:46

    I had many users controls but one refused to show in the Toolbox, even though I rebuilt the solution and it was checked in the Choose Items... dialog.

    Solution:

    1. From Solution Explorer I Right-Clicked the offending user control file and selected Exclude From Project
    2. Rebuild the solution
    3. Right-Click the user control and select Include in Project (assuming you have the Show All Files enabled in the Solution Explorer)

    Note this also requires you have the AutoToolboxPopulate option enabled. As @DaveF answer suggests.

    Alternate Solution: I'm not sure if this works, and I couldn't try it since I already resolved my issue, but if you unchecked the user control from the Choose Items... dialog, hit OK, then opened it back up and checked the user control. That might also work.

提交回复
热议问题