views:

12

answers:

1

Hi I have problem with control inheritance in WPF. I created a UserControl named BaseUserControl. I want for this control to be a base control for other WPF userControls. So I another UserControl called FirstComponent. In next step I changed this code

FirstComponent : UserControl

to this

FirstComponent : BaseControl

However during compilation I get this error

Partial declarations of 'controlinheritance.componenets.FirstComponent' must not specify different base classes 

What should I do to enamble FirstComponent derives from BaseControl

EDIT Thanks to abhishek answer I managed to inherit controls . Howerver I have another question. In base class I specified a property public Grid _MainGrid { get; set; }. Now I want in my derived class create an instance of this grid. So I used this code Howerver I get an error Property '_MainGrid' does not have a value. Line 8 Position 36.

+1  A: 

Did you see my complete article on it ?

http://www.dotnetfunda.com/articles/article832-define-base-class-for-window--usercontrol-.aspx

I hope that would help you in this.

abhishek
Thanks it helped me a lot. Could You look at my edigted message
Berial