开发者

WPF UserControl inherited from custom UserControl class not working

i am creating a UserControl in WPF but it is not directly inherited from UserControl class. My base class is something as shown below

public class MyUserControlBase: UserControl, IMyInterface1, IMyInterface2
{..}

Now in my Usercontrol project, i have changed the usercontrol class signature

FROM

public partial class MyUserControl: UserControl //This is by default when the project was created.

TO

public partial class MyUserControl: MyUserControlBase

But it is giving error "Parti开发者_运维问答al declarations of 'UI.MyUserControl' must not specify different base classes".

Please suggest what i have to change to make it run.


You also have to change where this control inherits from in the XAML part of your class. Still inheritance in WPF is a bit tricky, see this tutorial on how to get it right: http://svetoslavsavov.blogspot.com/2009/09/user-control-inheritance-in-wpf.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜