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?
精彩评论