static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Backstage backstage = (Backstage)d; if (e.OldValue != null) { backstage.RemoveLogicalChild(e.OldValue); } if (e.NewValue != null) { backstage.AddLogicalChild(e.NewValue); } }
private static void onIsLockedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Backstage backstage = (Backstage)d; Ribbon ribbon = backstage.FindRibbon(); if (ribbon != null && (bool)e.NewValue == true) { backstage.SetCurrentValue(IsOpenProperty, true); backstage._storeEnabledState = ribbon.IsEnabled; ribbon.SetCurrentValue(IsEnabledProperty, false); backstage.CommandBindings.Clear(); } else { ribbon?.SetCurrentValue(IsEnabledProperty, backstage._storeEnabledState); } }
/// <summary> /// Constructor /// </summary> /// <param name="adornedElement">Adorned element</param> /// <param name="backstage">Backstage</param> public BackstageAdorner(FrameworkElement adornedElement, Backstage backstage) : base(adornedElement) { KeyboardNavigation.SetTabNavigation(this, KeyboardNavigationMode.Cycle); this.Backstage = backstage; this.backstageContent = this.Backstage.Content; this.visualChildren = new VisualCollection(this) { this.backstageContent }; // TODO: fix it! (below ugly workaround) in measureoverride we cannot get RenderSize, we must use DesiredSize // Syncronize with visual size this.Loaded += this.OnLoaded; this.Unloaded += this.OnUnloaded; }
/// <summary> /// Constructor /// </summary> /// <param name="adornedElement">Adorned element</param> /// <param name="backstage">Backstage</param> public BackstageAdorner(FrameworkElement adornedElement, Backstage backstage) : base(adornedElement) { KeyboardNavigation.SetTabNavigation(this, KeyboardNavigationMode.Cycle); this.backstage = backstage; this.backstageContent = this.backstage.Content; this.visualChildren = new VisualCollection(this) { this.backstageContent }; // TODO: fix it! (below ugly workaround) in measureoverride we cannot get RenderSize, we must use DesiredSize // Syncronize with visual size this.Loaded += this.OnLoaded; this.Unloaded += this.OnUnloaded; }
/// <summary> /// Initializes a new instance of the <see cref="BackstageAdorner"/> class. /// </summary> /// <param name="adornedElement">Adorned element</param> /// <param name="backstage">Backstage</param> public BackstageAdorner(FrameworkElement adornedElement, Backstage backstage) : base(adornedElement) { KeyboardNavigation.SetTabNavigation(this, KeyboardNavigationMode.Contained); KeyboardNavigation.SetControlTabNavigation(this, KeyboardNavigationMode.Contained); KeyboardNavigation.SetDirectionalNavigation(this, KeyboardNavigationMode.Contained); this.Backstage = backstage; this.backstageContent = this.Backstage.Content; if (this.backstageContent is not null) { this.backstageTabControl = this.backstageContent as BackstageTabControl ?? UIHelper.FindVisualChild <BackstageTabControl>(this.backstageContent); } this.background = new Rectangle(); if (this.backstageTabControl is not null) { BindingOperations.SetBinding(this.background, Shape.FillProperty, new Binding { Path = new PropertyPath(Control.BackgroundProperty), Source = this.backstageTabControl }); BindingOperations.SetBinding(this.background, MarginProperty, new Binding { Path = new PropertyPath(BackstageTabControl.SelectedContentMarginProperty), Source = this.backstageTabControl }); } else { this.background.SetResourceReference(Shape.FillProperty, "WhiteBrush"); } this.visualChildren = new VisualCollection(this) { this.background, this.backstageContent }; }
// Handles IsSelected changed private static void OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { BackstageTabItem container = (BackstageTabItem)d; bool newValue = (bool)e.NewValue; if (newValue) { Backstage backstage = container.Parent as Backstage; if ((backstage != null) && (backstage.SelectedItem != container)) { if (backstage.SelectedItem is BackstageTabItem) { (backstage.SelectedItem as BackstageTabItem).IsSelected = false; } backstage.SelectedItem = container; } container.OnSelected(new RoutedEventArgs(Selector.SelectedEvent, container)); } else { container.OnUnselected(new RoutedEventArgs(Selector.UnselectedEvent, container)); } }
/// <summary> /// Default constructor /// </summary> public BackstageButton() { AddHandler(RibbonControl.ClickEvent, new RoutedEventHandler(OnClick)); Backstage = new Backstage(); Binding binding = new Binding("Background"); binding.Source = this; Backstage.SetBinding(Backstage.BackgroundProperty, binding); AddLogicalChild(Backstage); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Ribbon_control = ((Fluent.Ribbon)(target)); #line 17 "..\..\..\MainWindow.xaml" this.Ribbon_control.IsMinimizedChanged += new System.Windows.DependencyPropertyChangedEventHandler(this.Ribbon_control_IsMinimizedChanged); #line default #line hidden return; case 2: this.backstage = ((Fluent.Backstage)(target)); return; case 3: this.bsi_help = ((Fluent.BackstageTabItem)(target)); return; case 4: this.grid_help = ((System.Windows.Controls.Grid)(target)); return; case 5: this.bsi_settings = ((Fluent.BackstageTabItem)(target)); return; case 6: this.grid_settings = ((System.Windows.Controls.Grid)(target)); return; case 7: this.bsi_close = ((Fluent.BackstageTabItem)(target)); #line 34 "..\..\..\MainWindow.xaml" this.bsi_close.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.bsi_close_MouseLeftButtonDown); #line default #line hidden return; case 8: this.bt_search = ((Fluent.Button)(target)); #line 47 "..\..\..\MainWindow.xaml" this.bt_search.Click += new System.Windows.RoutedEventHandler(this.bt_geraetSuchen); #line default #line hidden return; case 9: this.bt_geraetEdit = ((Fluent.Button)(target)); #line 50 "..\..\..\MainWindow.xaml" this.bt_geraetEdit.Click += new System.Windows.RoutedEventHandler(this.bt_geraetBearbeiten); #line default #line hidden return; case 10: this.bt_abfrage = ((Fluent.Button)(target)); #line 53 "..\..\..\MainWindow.xaml" this.bt_abfrage.Click += new System.Windows.RoutedEventHandler(this.bt_abfrageStarten); #line default #line hidden return; case 11: this.tbl_info = ((System.Windows.Controls.TextBlock)(target)); return; case 12: this.logo = ((System.Windows.Controls.Image)(target)); return; case 13: this.MainGrid = ((System.Windows.Controls.Grid)(target)); return; case 14: this.grid_additionalThings = ((System.Windows.Controls.Grid)(target)); return; } this._contentLoaded = true; }
private void HandleUnloaded(object sender, RoutedEventArgs e) { this.ParentBackstage = null; }
private void HandleLoaded(object sender, RoutedEventArgs e) { this.ParentBackstage = UIHelper.GetParent <Backstage>(this); }
/// <summary> /// Default constructor /// </summary> public BackstageButton() { Backstage = new Backstage(); Binding binding = new Binding("Background"); binding.Source = this; Backstage.SetBinding(Backstage.BackgroundProperty, binding); AddLogicalChild(Backstage); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.OpenCommand = ((System.Windows.Input.CommandBinding)(target)); #line 28 "..\..\..\MainWindow.xaml" this.OpenCommand.CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.OpenCommandCanExecute); #line default #line hidden #line 28 "..\..\..\MainWindow.xaml" this.OpenCommand.Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OpenCommandExecuted); #line default #line hidden return; case 2: this.NewCommand = ((System.Windows.Input.CommandBinding)(target)); #line 29 "..\..\..\MainWindow.xaml" this.NewCommand.CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.NewCommandCanExecute); #line default #line hidden #line 29 "..\..\..\MainWindow.xaml" this.NewCommand.Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.NewCommandExecuted); #line default #line hidden return; case 3: this.SaveCommand = ((System.Windows.Input.CommandBinding)(target)); #line 30 "..\..\..\MainWindow.xaml" this.SaveCommand.CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.SaveCommandCanExecute); #line default #line hidden #line 30 "..\..\..\MainWindow.xaml" this.SaveCommand.Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.SaveCommandExecuted); #line default #line hidden return; case 4: this.SaveAsCommand = ((System.Windows.Input.CommandBinding)(target)); #line 31 "..\..\..\MainWindow.xaml" this.SaveAsCommand.CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.SaveAsCommandCanExecute); #line default #line hidden #line 31 "..\..\..\MainWindow.xaml" this.SaveAsCommand.Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.SaveAsCommandExecuted); #line default #line hidden return; case 5: #line 32 "..\..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.RecentObjectSelected); #line default #line hidden return; case 6: this.AddDivisionCommand = ((System.Windows.Input.CommandBinding)(target)); #line 34 "..\..\..\MainWindow.xaml" this.AddDivisionCommand.CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.AddDivisionCommandCanExecute); #line default #line hidden #line 34 "..\..\..\MainWindow.xaml" this.AddDivisionCommand.Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.AddDivisionCommandExecuted); #line default #line hidden return; case 7: this.ApplicationRibbon = ((Fluent.Ribbon)(target)); return; case 8: this.FileMenu = ((Fluent.Backstage)(target)); return; case 9: this.MenuRecentItem = ((Fluent.BackstageTabItem)(target)); return; case 10: this.MenuContextHeaderDivisible = ((Fluent.RibbonContextualTabGroup)(target)); return; case 11: this.MenuContextFillable = ((Fluent.RibbonContextualTabGroup)(target)); return; case 12: this.TabHome = ((Fluent.RibbonTabItem)(target)); return; case 13: this.ButtonPaste = ((Fluent.SplitButton)(target)); return; case 14: this.ButtonCut = ((Fluent.Button)(target)); return; case 15: this.ButtonCopy = ((Fluent.Button)(target)); return; case 16: this.TabDivision = ((Fluent.RibbonTabItem)(target)); return; case 17: this.GroupDivision = ((Fluent.RibbonGroupBox)(target)); return; case 18: this.ButtonNoDivision = ((Fluent.Button)(target)); return; case 19: this.ButtonFess = ((Fluent.Button)(target)); return; case 20: this.ButtonPale = ((Fluent.Button)(target)); return; case 21: this.ButtonBend = ((Fluent.Button)(target)); return; case 22: this.ButtonBendSinister = ((Fluent.Button)(target)); return; case 23: this.GroupAdvancedDivision = ((Fluent.RibbonGroupBox)(target)); return; case 24: this.ButtonSaltire = ((Fluent.Button)(target)); return; case 25: this.ButtonPartyCross = ((Fluent.Button)(target)); return; case 26: this.ButtonPall = ((Fluent.Button)(target)); return; case 27: this.ButtonTiercedBend = ((Fluent.Button)(target)); return; case 28: this.ButtonTiercedBendSinister = ((Fluent.Button)(target)); return; case 29: this.ButtonTiercedPale = ((Fluent.Button)(target)); return; case 30: this.ButtonTiercedFess = ((Fluent.Button)(target)); return; case 31: this.TabOrdinaries = ((Fluent.RibbonTabItem)(target)); return; case 32: this.GroupHonourableOrdinaries = ((Fluent.RibbonGroupBox)(target)); return; case 33: this.GroupSubOrdinaries = ((Fluent.RibbonGroupBox)(target)); return; case 34: this.TabTinctures = ((Fluent.RibbonTabItem)(target)); return; case 35: this.GroupLabelBasicTinctures = ((Fluent.RibbonGroupBox)(target)); return; case 36: this.ButtonOr = ((Fluent.Button)(target)); return; case 37: this.ButtonArgent = ((Fluent.Button)(target)); return; case 38: this.ButtonAzure = ((Fluent.Button)(target)); return; case 39: this.ButtonVert = ((Fluent.Button)(target)); return; case 40: this.ButtonGules = ((Fluent.Button)(target)); return; case 41: this.ButtonSable = ((Fluent.Button)(target)); return; case 42: this.GroupLabelModernTinctures = ((Fluent.RibbonGroupBox)(target)); return; case 43: this.GroupLabelFurs = ((Fluent.RibbonGroupBox)(target)); return; case 44: this.GroupLabelCustomTinctures = ((Fluent.RibbonGroupBox)(target)); return; case 45: this.StatusBar = ((System.Windows.Controls.Primitives.StatusBar)(target)); return; case 46: this.MainFrame = ((GBlason.Control.Aggregate.CustomGUI)(target)); return; } this._contentLoaded = true; }
private void HandleLoaded(object sender, RoutedEventArgs e) { this.ParentBackstage = UIHelper.GetParent<Backstage>(this); }