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