G
G
Gnom302018-05-08 09:28:13
OOP
Gnom30, 2018-05-08 09:28:13

How to inherit an abstract class in C#, WPF?

hi guys!
A set of uniform WPF classes (Window, Page or UserControl) require uniform behavior, which would be very elegant and awesome to put into a base abstract class like this:

public abstract class BaseWindow
  {
    public abstract void AddintionalInit();
    public abstract void VisualInit();

    public string Converter()
    {
      return string.Empty; // TODO implement
    }
  }

However, C# writes that it is impossible: Partial declarations of ' RanksWindow' must not specify different base classes
aspx , writes in the xaml markup that cannot be the root of a XAML file because it was defined using XAML In the comments there, they also write that the method worked in VS2005 SP1 + WPF, but stopped working in VS2008 and all subsequent ones.
And how can I solve my problem? A temporary solution that I came up with: an interface for the entire group of controls and a utility class whose methods are twitching in each of the controls. But this is a solution through the ass, help!
UPD: thanks for the answers: as it turned out - this is impossible. Apparently I have too high expectations from Microsoft technology, I will leave the solution with the interface and the helper class.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Griboks, 2018-05-08
@Griboks

What's the end question? Such seasoned programmers have no place on this forum.
Honestly, you can just go to the translator. But I'll clarify that c# reports a lack of support for multiple inheritance. What does it mean? This means that you have two class declarations in your code RanksWindow, one inherits from BaseWindow, and the second - something else, probably Window. And you need to specify only one parent. And also learn English, or at least learn how to use a translator. And the most important thing is to write culturally.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question