开发者

Setting a different ancestor for WPF UserControl in VS2008

开发者 https://www.devze.com 2023-01-24 15:09 出处:网络
I would like to create a WPF user control that inherits from a different ancestor than UserControl class.

I would like to create a WPF user control that inherits from a different ancestor than UserControl class.

The problem is that visual studio keeps overriding my setting and change it back to UserControl resulting in an error: Partial declarations of 'XXX' must not specify different base classes

every time I re-build the project the auto generated file xxx.g.cs is being regenerated with Us开发者_JS百科erControl as the parnet...

I'm using VS2008 and C#

Any ideas?

Thanks.


You'll want to create a CustomControl instead of a UserControl. A brief list of the differences can be found here.

If you want to create your own UI you can either overwrite the Template property of the control with a global style or a quick Google search should give you some tutorials about how to create CustomControls with their own default UI.


In the XAML file of your control, have you changed the document tag from UserControl to something else?

0

精彩评论

暂无评论...
验证码 换一张
取 消