locked
Why does blend create duplicate assets of my Inherited Controls? RRS feed

  • Question

  • SCENARIO:

    I've created some classes which simply inherit from existing controls. Therefore, I have CustomButton.xaml which just inherits from ButtonCustomComboBox.xaml which just inherits from ComboBox, etc...

    PROBLEM:

    When I reference my DLL that contains these inherited controls, I get duplicate controls in my Assest panel in Blend. So I see two CustomButton, two CustomComboBox, etc...

    Does anyone know why this happens?

    Thanks!
    Friday, September 25, 2009 7:26 PM

Answers

  • Hi,
          We investigated your project and you see two entries of each control in Asset Panel because you indeed have two types defined in your project. You can see DuplicateAssets.dll in reflector and you will find two copies of each control, one in DuplicateAssets (default namespace) and other in DuplicateAssets.Positron.Cad.WindowsControls.WPF (namespace you added in the code behind).

     

    This happens because VB always includes the assembly name as the default namespace. If you remove your added namespace from the code behind you will find just one entry in Asset tool.

    • Marked as answer by maximus37 Friday, October 2, 2009 3:58 AM
    Friday, October 2, 2009 2:09 AM
  • Hi,
         You can do this in Visual Studio 

    1. Open your project in VS
    2. Right click on your project and click on Properties
    3. In Project Properties, modify the Root Namespace to your value
    4. Build

    Hope this helps, sorry for delayed response.

    Regards,
    Navit Saxena
    • Marked as answer by maximus37 Friday, October 9, 2009 3:15 AM
    Thursday, October 8, 2009 6:38 PM

All replies

  • Can you please clarify that you see two instances of CustomComboBox when you search in the Asset library? Or is that you have two separate category selections that give you this scenario?

    Also, are you setting up a project reference to this library, or a direct reference to the assembly?

    Thanks,
    Unni
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Saturday, September 26, 2009 7:21 PM
  • I see two instances of CustomComboBox in the Asset Library, and I'm referencing the controls from an assembly, not a project reference.

    I have a screenshot of the problem, but how can I post it here ??

    Tuesday, September 29, 2009 2:20 PM
  • I see two instances of CustomComboBox in the Asset Library, and I'm referencing the controls from an assembly, not a project reference.

    I have a screenshot of the problem, but how can I post it here ??
    Wednesday, September 30, 2009 3:30 PM
  • Hi,
          Can you please send the screenshot and the assembly to navits@microsoft.com and we will be happy to take a look at it.

    Regards,
    Navit Saxena
    Wednesday, September 30, 2009 9:40 PM
  • Hi,
          We investigated your project and you see two entries of each control in Asset Panel because you indeed have two types defined in your project. You can see DuplicateAssets.dll in reflector and you will find two copies of each control, one in DuplicateAssets (default namespace) and other in DuplicateAssets.Positron.Cad.WindowsControls.WPF (namespace you added in the code behind).

     

    This happens because VB always includes the assembly name as the default namespace. If you remove your added namespace from the code behind you will find just one entry in Asset tool.

    • Marked as answer by maximus37 Friday, October 2, 2009 3:58 AM
    Friday, October 2, 2009 2:09 AM
  • Ohhh, that makes sense! Thank you for the answer!

    I have one last question, how can I make my controls (in the xaml files, not code-behind) fall into my custom namespace and not the default one?

    Friday, October 2, 2009 3:58 AM
  • I have one last question ...

    I have specified a namespace in my code-behind file...how do I have my XAML file fall into the same namespace ???
    Monday, October 5, 2009 8:12 PM
  • Hi,
         You can do this in Visual Studio 

    1. Open your project in VS
    2. Right click on your project and click on Properties
    3. In Project Properties, modify the Root Namespace to your value
    4. Build

    Hope this helps, sorry for delayed response.

    Regards,
    Navit Saxena
    • Marked as answer by maximus37 Friday, October 9, 2009 3:15 AM
    Thursday, October 8, 2009 6:38 PM
  • Thanks! All is working fine now  :)
    Friday, October 9, 2009 3:15 AM