none
Changing namespace of UserControl class - That g.i.cs file!

    Question

  • Hi,

    I want to move a UserControl derived class to another namespace. Changing the namespace in the code behind file e.g. myUserControl.xaml.cs, causes the InitializeComponent() call to be unresolved as the myUserControl.g.i.cs still will be auto generated with the old namespace. How do I change the namespace of a XAML UserControl so that the g.i.cs file will also be changed to the new namespace.

    Thanks.
    Best regards Jesper Odgaard Nielsen
    Saturday, October 31, 2009 3:53 PM

Answers

  • The generated file is generated based on the xaml file. At the top of the xaml file, the corresponding class name is located (that's why the code behind is a partial class). Make sure the namespace and class name in the xaml are the same as your code behind.
    Geert van Horrik - CatenaLogic
    Visit my blog: http://blog.catenalogic.com

    Looking for a way to deploy your updates to all your clients? Try Updater!
    Saturday, October 31, 2009 4:33 PM

All replies

  • The generated file is generated based on the xaml file. At the top of the xaml file, the corresponding class name is located (that's why the code behind is a partial class). Make sure the namespace and class name in the xaml are the same as your code behind.
    Geert van Horrik - CatenaLogic
    Visit my blog: http://blog.catenalogic.com

    Looking for a way to deploy your updates to all your clients? Try Updater!
    Saturday, October 31, 2009 4:33 PM
  • Hi,

    I want to move a UserControl derived class to another namespace. Changing the namespace in the code behind file e.g. myUserControl.xaml.cs, causes the InitializeComponent() call to be unresolved as the myUserControl.g.i.cs still will be auto generated with the old namespace. How do I change the namespace of a XAML UserControl so that the g.i.cs file will also be changed to the new namespace.

    Thanks.
    Best regards Jesper Odgaard Nielsen

    Have you tried to Build? I think the error goes away then
    Kenneth
    Saturday, October 31, 2009 11:26 PM