分部声明一定不能指定不同的基类 [英] Partial declarations must not specify different base classes

查看:6579
本文介绍了分部声明一定不能指定不同的基类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我新的WPF。

我有一个名为一个WPF页 StandardsDefault 。在后面的代码, StandardsDefault 为继承,像所有其他网页。

I have a wpf page named StandardsDefault. In the code behind, StandardsDefault is inheriting Page, like all other pages.

<Page x:Class="namespace.StandardsDefault"

public partial class StandardsDefault : Page

现在我已经创建了一个新的类 CountryStandards 。这是继承 StandardsDefault 而不是页

Now I have created a new class CountryStandards which is inheriting StandardsDefault instead of page.

<Page x:Class="namespace.CountryStandards"

public partial class CountryStandards : StandardsDefault

我并没有改变的XAML。我得到的误差

I have not changed the XAML . I am getting the error as

'CountryStandards的分部声明切不可指定不同的基类

我想问题可能是设计者不继承相同的类。
,而我需要以某种方式实现继承,因为有许多常用的方法这是在许多标准的页面,如 CountryStandards

I think the problem may be that the designer is not inheriting the same class. But I need to somehow implement inheritance since there are many common methods which are to be used in many standard pages like CountryStandards

谁能帮我出

推荐答案

您有您的CountryStandards XAML更改为:?

You have to change your CountryStandards XAML to:

<src:StandardsDefault x:Class="namespace.CountryStandards" 
    xmlns:src="NamespaceOfStandardsDefault" ... />

有一个的good文章了解在WPF自定义窗口/页继承。

There is a good article about inheriting from a custom Window/Page in WPF.

这篇关于分部声明一定不能指定不同的基类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆