none
Abstract class in WPF Control class

    Question

  • Hi: I have created a WPF Application(MyApp) in C#.  I created 2 folders under the Project--Business, UserControls. Now under Business I have added a WPF Control named:AbsControl and then made it as an abstract Class.

    namespace MyApp.Business

    {

    Public abstract class AbsControl:UserControl-----------------------Giving error under AbsControl

    {

    public abstract int AbsID;

    }

    }//end class

    Under UserControls folder, I added a WPF Control(Mycontrol) and it inherits from the AbsControl.

    namespace MyApp.UserControls

    {

    Public partial class MyControl:AbsControl

    {

    public override ID

    {

    return AbsID;

    }

    }//end class

    Question is: When compiling, its giving error at the abstract class and I had to declare it as partial.

    It was as above:Public abstract class AbsControl:UserControl

    I changed it to:Public abstract partial class AbsControl:UserControl

    Next hwen compile, another error at the same:Public abstract partial class AbsControl:UserControl

    Error:Missing partial modifier on declaration of type ; another partial declaration of this type exists

    ----I gooled the forums. found that in WPF XAML file in the abstract class may be I have to do some change. Did not understand much.

    Please help me. Thanks. Syed

    Tuesday, May 29, 2012 2:26 AM

Answers

All replies