English 中文(简体)
g.c. 班级将基级改为违约
原标题:g.i.cs class keeps changing its base class back to its default

g.c. 班级将基级改为违约

System.Windows.Controls.Page

After I ve changed it to

System.Windows.Controls.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, but 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 :-)

最佳回答

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.

问题回答

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"

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! :)





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签