TheWommies
TheWommies

Reputation: 5072

Inheriting from a WPF Window or User Control

Is there a way to inherit from a WPF Window or UserControl that has XAML associated wit it?

Thanks

Upvotes: 0

Views: 208

Answers (1)

Geoff Cox
Geoff Cox

Reputation: 6152

Noope. Only the most derived class can be associated with the XAML. This is because the XAML system instantiates the code-behind instance. You can inherit from non-XAML associated UserControl and Control base classes.

The recommended approach for separating the code inheritance vs. the look and feel inheritance is to use custom styles. These have inheritance via the BasedOn attribute.

Upvotes: 1

Related Questions