locked
adding custom WPF component to toolbox?

    Question


  • i'm trying to add a custom component that i recently created to the toolbox...
    but it doesn't work when i try to drop the component to my Windows1.xaml...


    thank you..



    pd. i've been working .NET 3.5 VS2008beta2
    Friday, August 24, 2007 6:19 PM

Answers

  • You can add WPF components to the toolbox by going to the WPF Components tab of the Add Toolbox Items UI that comes up after you right click on the toolbox and select "Choose Items..." and browsing to the assembly that contains your custom component.

     

    Once you have your custom control on the toolbox, you can add it to the design surface only, not the XAML editor.

     

    Tuesday, August 28, 2007 6:00 PM
    Moderator
  • For me, my custom control doesn't even show up in the toolbox after adding it (using an horrendously slow "Choose Items..." dialog). No error messages. The computer hasn't had any previous installs of VS or WPF. And why aren't custom controls added automatically in the toolbox, like in the WinForms designer? I just can't be bothered with this kind of user-unfriendliness. I was going to give WPF a second try now that VS2008 is finally out, but I guess I'll have to wait a while longer.

    Sunday, December 16, 2007 6:33 PM
  • For those of you that are having trouble with the toolbox, please try the following:

     

    A) Ensure that you are using the WPF Components tab of the Choose Items dialog

    B) Ensure that the designer has focus (click on the designer) when using the toolbox, you can only add items to the designer and not to the XAML editor

    C) Try re-initializing the toolbox:

     

    1. Exit Visual Studio

    2. Navigate to %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\9.0

    3. Delete the TBD files found there (these are hidden by default)

    4. Re-start Visual Studio and open your WPF application - the toolbox will now be reinitialized

     

    Sorry for any inconveniences you may be having.

     

    Tuesday, January 01, 2008 12:17 AM
    Moderator

All replies

  • You can ask questions related to designer on this forum.
    Monday, August 27, 2007 7:15 AM
  • You can add WPF components to the toolbox by going to the WPF Components tab of the Add Toolbox Items UI that comes up after you right click on the toolbox and select "Choose Items..." and browsing to the assembly that contains your custom component.

     

    Once you have your custom control on the toolbox, you can add it to the design surface only, not the XAML editor.

     

    Tuesday, August 28, 2007 6:00 PM
    Moderator
  • Can you elborate because it simply does not work.  I select a few components, click ok, the PC whirls for a couple seconds and, nada, no new tools, no anything.

     

    Monday, December 10, 2007 9:39 PM
  •  

    I have added it to the Toolbar, and it displays fine. I can't drag the custom contorl onto the design surface.  I even tried a subclass base WPF button, that I subclassed, and I got nothing.

     

    What won't it show up?

     

     

    Thursday, December 13, 2007 10:33 PM
  • For me, my custom control doesn't even show up in the toolbox after adding it (using an horrendously slow "Choose Items..." dialog). No error messages. The computer hasn't had any previous installs of VS or WPF. And why aren't custom controls added automatically in the toolbox, like in the WinForms designer? I just can't be bothered with this kind of user-unfriendliness. I was going to give WPF a second try now that VS2008 is finally out, but I guess I'll have to wait a while longer.

    Sunday, December 16, 2007 6:33 PM
  • For those of you that are having trouble with the toolbox, please try the following:

     

    A) Ensure that you are using the WPF Components tab of the Choose Items dialog

    B) Ensure that the designer has focus (click on the designer) when using the toolbox, you can only add items to the designer and not to the XAML editor

    C) Try re-initializing the toolbox:

     

    1. Exit Visual Studio

    2. Navigate to %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\9.0

    3. Delete the TBD files found there (these are hidden by default)

    4. Re-start Visual Studio and open your WPF application - the toolbox will now be reinitialized

     

    Sorry for any inconveniences you may be having.

     

    Tuesday, January 01, 2008 12:17 AM
    Moderator
  • A and B sort of worked for me. C was not necessary.

     

    If your control is in the current project, navigate to that project and choose the assembly - even if it is an exe. I'm not sure if one has to manage debug/release versions. 

     

    Also, this is counter intuitive to any C# WinForms developers. User controls appear automatically in the control toolbox. Maybe we have to wait for VS 2009.

     

    Still, VS2008 has much to offer and I (think I) love it. 

    Tuesday, January 15, 2008 11:54 AM
  •  

    >I'm not sure if one has to manage debug/release versions. 

    Yes you will. When you take this approach you add a reference to the assembly on disk - either the debug or retail version. This means if you add a referenc to the debug version, when you change to retail you will have to manually delete and re-add the correct reference.

     

    An alternative approach is to avoid using the toolbox for controls that are part of your current project. Use intellisense in the XAML editor instead - you get statement completion for the namespace declaration and for the control declaration.

     

    mark

    Tuesday, January 15, 2008 4:55 PM
    Owner
  • For myself doesn't work in VS2008 and 2010. 

    Any other suggestion ?

    please and Thank you!!!

    Saturday, June 12, 2010 1:51 PM