using System.Windows; using System.Windows.Input; namespace Waaagh.CustomControl { public class WaaaghWindow: Window { #region Static static WaaaghWindow() { DefaultStyleKeyProperty.OverrideMetadata(typeof(WaaaghWindow), new FrameworkPropertyMetadata(typeof(WaaaghWindow))); } public static readonly DependencyProperty TitleBarContentProperty = DependencyProperty.Register( "TitleBarContent", typeof(object), typeof(WaaaghWindow), new PropertyMetadata(null)); public static readonly DependencyProperty TitleBarButtonsProperty = DependencyProperty.Register( "TitleBarButtons", typeof(List), typeof(WaaaghWindow), new PropertyMetadata(new List())); #endregion public WaaaghWindow() { DefaultStyleKey = typeof(WaaaghWindow); CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, (s, e) => { SystemCommands.CloseWindow(this); })); CommandBindings.Add(new CommandBinding(SystemCommands.MinimizeWindowCommand, (s, e) => { SystemCommands.MinimizeWindow(this); })); CommandBindings.Add(new CommandBinding(SystemCommands.MaximizeWindowCommand, (s, e) => { SystemCommands.MaximizeWindow(this); })); CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand, (s, e) => { SystemCommands.RestoreWindow(this); })); } public object TitleBarContent { get { return (object)GetValue(TitleBarContentProperty); } set { SetValue(TitleBarContentProperty, value); } } public List TitleBarButtons { get { return (List)GetValue(TitleBarButtonsProperty); } set { SetValue(TitleBarButtonsProperty, value); } } } }