首先,感谢 @/*梦里花落知多少*/ 的无私分享,本文中的所有内容皆来自于 http://www.cnblogs.com/anding/p/5018363.html,加上我自己做的少许修改。
有关控件样式,详情就看 /*梦里花落知多少*/ 的 WPF自定义控件与样式 系列文章
我做的修改:
1.修复WindowBase因为设置AllowsTransparency为True导致XP系统上窗体显示异常的问题;
2.WindowBase默认样式添加自定义内容添加,添加位置为最小化按钮左边。
<core:WindowBase x:Class="MainShell.ShellView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:core="clr-namespace:WPFStyle;assembly=WPFStyle" xmlns:cm="clr-namespace:MainShell.Framework" xmlns:str="clr-namespace:Multilanguage;assembly=Multilanguage" xmlns:system="clr-namespace:System;assembly=mscorlib" Height="600" Width="900" Title="{str:StringResource ShellView_Title,DefaultValue=WPF-CM框架}"> <core:ControlAttachProperty.AttachContent> <ControlTemplate > <core:FButton Width="Auto" Style="{DynamicResource FButton_Transparency}" Content="{str:StringResource App_CurLang,DefaultValue=中文}" cm:Message.Attach="[Event Click]= [Action ChangeLang]"></core:FButton> </ControlTemplate> </core:ControlAttachProperty.AttachContent>