Why is there no visual inheritance in WPF?

In Windows Forms, it was sometimes useful to have one window inherited from another window. But in WPF this is forbidden. Why is there no visual inheritance for WPF windows?

+7
inheritance wpf
source share
3 answers

In WPF, great efforts have been made to branch visual from logical. Because of this, there is a LOT of freedom to make the user interface look like you want. All controls, including windows, are "carefree." You can provide your own look with templates and styles. A default visual style was provided, which makes everything look as you expected, but you don't need to use it.

+2
source share

The reason WPF does not support visual inheritance is because the form design is achieved using markup (.xaml) rather than winforms that use code to create the layout. The code behind is extensible, but the markup is not. The same goes for web forms. Asp.net master pages offer quasi-visual inheritance. Thus, this is a compromise, markup gives the advantage of a clear separation of the layout and data, while the code-code provides visual extensibility. This is a bit of a shame, because visual extensibility works so well, creating consistency in the GUI, and also very fast development. Well, it seems that flash is more in demand than functionality. WPF is fine ...

+5
source share

WPF is intentionally very different from Windows Forms. The ability model is not based on Windows, but on such classes as the Dependency Object , Visual , UIElement . You can also dramatically change the behavior of existing things using control patterns, styles, data binding, and other methods.

I urge you to experiment! WPF is very simple prototype using

+2
source share

All Articles