<controls:MetroWindow x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
Title="测试按钮" Height="350" Width="525">
<controls:MetroWindow.RightWindowCommands>
<controls:WindowCommands>
<Button Content="settings" />
<Button Content="设置" />
</controls:WindowCommands>
</controls:MetroWindow.RightWindowCommands>
这是MahApps框架某些示例代码,其中controls:MetroWindow.RightWindowCommands标签内就是关于定制它自定义标题栏左边的部分。
在基于继承Window父类的类和对WIndow控件模板重写的方式实现的自定义窗体,在重写的window控件模板里,使用grid将窗体分成标题栏和内容。在标题栏中又用了一个Grid分割左右区域。而在这个Grid被分割区域的左边,在继承基础窗体的窗体中,如何实现添加控件等操作?