第二种效果:
public partial class CustomizeWindowController : WindowController { public CustomizeWindowController() { TargetWindowType = WindowType.Main; } protected override void OnActivated() { base.OnActivated(); WindowTemplateController controller = Frame.GetController<WindowTemplateController>(); controller.CustomizeWindowCaption += Controller_CustomizeWindowCaption; } private void Controller_CustomizeWindowCaption(object sender, CustomizeWindowCaptionEventArgs e) { //e.WindowCaption.Text = "我是窗口标题"; e.WindowCaption.SecondPart += " (Powered by XAF)"; } protected override void OnDeactivated() { base.OnDeactivated(); WindowTemplateController controller = Frame.GetController<WindowTemplateController>(); controller.CustomizeWindowCaption -= Controller_CustomizeWindowCaption; } }
第三种效果:自定义分隔符号(默认是一个Dash)
public partial class CustomizeWindowController : WindowController { public CustomizeWindowController() { TargetWindowType = WindowType.Main; } protected override void OnActivated() { base.OnActivated(); WindowTemplateController controller = Frame.GetController<WindowTemplateController>(); controller.CustomizeWindowCaption += Controller_CustomizeWindowCaption; } private void Controller_CustomizeWindowCaption(object sender, CustomizeWindowCaptionEventArgs e) { //e.WindowCaption.Text = "我是窗口标题"; e.WindowCaption.SecondPart += " (Powered by XAF)"; e.WindowCaption.Separator = "✔"; } protected override void OnDeactivated() { base.OnDeactivated(); WindowTemplateController controller = Frame.GetController<WindowTemplateController>(); controller.CustomizeWindowCaption -= Controller_CustomizeWindowCaption; } }
第四种:前后两部分,位值互换
private void Controller_CustomizeWindowCaption(object sender, CustomizeWindowCaptionEventArgs e) { string TmpString = e.WindowCaption.FirstPart; e.WindowCaption.FirstPart = e.WindowCaption.SecondPart; e.WindowCaption.SecondPart = TmpString; }
第五种:前后两部分,只展示一部分
(完)