WaaaghWindow.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Windows;
  2. using System.Windows.Input;
  3. namespace Waaagh.CustomControl {
  4. public class WaaaghWindow: Window {
  5. #region Static
  6. static WaaaghWindow() {
  7. DefaultStyleKeyProperty.OverrideMetadata(typeof(WaaaghWindow), new FrameworkPropertyMetadata(typeof(WaaaghWindow)));
  8. }
  9. public static readonly DependencyProperty TitleBarContentProperty = DependencyProperty.Register(
  10. "TitleBarContent", typeof(object), typeof(WaaaghWindow),
  11. new PropertyMetadata(null));
  12. public static readonly DependencyProperty TitleBarButtonsProperty = DependencyProperty.Register(
  13. "TitleBarButtons", typeof(List<object>), typeof(WaaaghWindow),
  14. new PropertyMetadata(new List<object>()));
  15. #endregion
  16. public WaaaghWindow() {
  17. DefaultStyleKey = typeof(WaaaghWindow);
  18. CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, (s, e) => { SystemCommands.CloseWindow(this); }));
  19. CommandBindings.Add(new CommandBinding(SystemCommands.MinimizeWindowCommand, (s, e) => { SystemCommands.MinimizeWindow(this); }));
  20. CommandBindings.Add(new CommandBinding(SystemCommands.MaximizeWindowCommand, (s, e) => { SystemCommands.MaximizeWindow(this); }));
  21. CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand, (s, e) => { SystemCommands.RestoreWindow(this); }));
  22. }
  23. public object TitleBarContent {
  24. get { return (object)GetValue(TitleBarContentProperty); }
  25. set { SetValue(TitleBarContentProperty, value); }
  26. }
  27. public List<object> TitleBarButtons {
  28. get { return (List<object>)GetValue(TitleBarButtonsProperty); }
  29. set { SetValue(TitleBarButtonsProperty, value); }
  30. }
  31. }
  32. }