以我们的Eallies OA系统为例,实现PageBase的方法如下:
1、在Eallies.OA.UI.Controls.Logical项目中添加一个纯的Class,并让其继承于System.Windows.Controls.Page类。
2、在Eallies.OA.UI项目中更改Page的CS代码,让其继承于Eallies.OA.UI.Controls.Logical.PageBase类。
3、在Eallies.OA.UI项目中更改Page的XAML代码,增加引用xmlns:logical="clr-namespace:Eallies.OA.UI.Controls.Logical;assembly=Eallies.OA.UI.Controls.Logical",然后将根节点改成logical:PageBase。
1、在Eallies.OA.UI.Controls.Logical项目中添加一个纯的Class,并让其继承于System.Windows.Controls.Page类。
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Windows.Controls;
6
7
namespace Eallies.OA.UI.Controls.Logical
8 {
9
public
class
PageBase :
Page
10 {
11 }
12 }
1
using System;
2
using System.Collections;
3
using System.Collections.Generic;
4
using System.Linq;
5
using System.Text;
6
using System.Windows;
7
using System.Windows.Controls;
8
using System.Windows.Data;
9
using System.Windows.Documents;
10
using System.Windows.Input;
11
using System.Windows.Media;
12
using System.Windows.Media.Imaging;
13
using System.Windows.Navigation;
14
using System.Windows.Shapes;
15
using Eallies.OA.UI.Controls.Logical;
16
17
namespace Eallies.OA.UI.User
18 {
19
public
partial
class
List :
PageBase
20 {
21 }
22 }
1
<
logical
:
PageBase
2
xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
xmlns
:
x
="http://schemas.microsoft.com/winfx/2006/xaml"
4
xmlns
:
logical
="clr-namespace:Eallies.OA.UI.Controls.Logical;assembly=Eallies.OA.UI.Controls.Logical"
5
x
:
Class
="Eallies.OA.UI.User.List">
6
</
logical
:
PageBase
>
本文转自 Eallies 51CTO博客,原文链接:http://blog.51cto.com/eallies/79057,如需转载请自行联系原作者