g.i.cs class keeps changing its base class back to its default
g.i.cs class keeps changing its base class back to its default
System.Windows.Controls.Page
After I've changed it to
System.Windows.Controls.UserControl
I need it to be a UserControl because the other partial class' base class is a UserControl
After compiling I get the message
"...file.g.i.cs This file has been modified outside of the source editor. Do you want to reload it?"
If I say no, I can compile, bu开发者_如何学JAVAt after a while, it switches back again. If I choose yes, it instantly switches back.
Any ideas?
Oh, and no one else is working on the files :-)
Look at the beginning of your XAML. You will see a tag that opens with ... change that to and then do the same for the closing tag at the bottom.
You may also have to update your code behind file to make sure the class it defines isn't explicitly derived from the wrong thing.
The file is constantly changing because it is a generated file. this indicates the g in the name. To change a WPF view's base class you have to change it either in the code behind file as well as in WPF itself.
To change it in WPF, you can use the Class attribute:
x:Class="Name.Space.ClassName"
Ok, I didn't find the solution, but I found out why it happens in the first place. When adding the Silver Light file, I chose 'Silverlight Page'. I should have chosen 'Silverlight User Control'. I guess once you choose one, you can't turn it into the other... Hope this helps someone eventually lol.
If you're working on a WPF project, then you need to change window attributes in the XAML file.. in my case I had to change the x:class
and xmlns:local
.
good luck! :)
精彩评论