/// <summary> /// Set the active window as dock ability /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnGetActiveWindowDockAbility(object sender, RoutedEventArgs e) { MenuItem item = sender as MenuItem; FrameworkElement element = DockingManager.ActiveWindow; DockAbility ability = DockingManager.GetDockAbility(element); foreach (MenuItem subitem in item.Items) { DockAbility dockAbility = ( DockAbility )Enum.Parse(typeof(DockAbility), ( string )subitem.Header); subitem.IsChecked = (dockAbility & ability) == dockAbility; } }
/// <summary> /// Set the dock ability /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnDockAbilityChanged(object sender, RoutedEventArgs e) { //Setting Dock Ability MenuItem item = sender as MenuItem; FrameworkElement element = DockingManager.ActiveWindow; DockAbility ability = DockingManager.GetDockAbility(element); DockAbility dockAbility = ( DockAbility )Enum.Parse(typeof(DockAbility), ( string )item.Header); if (item.IsChecked) { item.IsChecked = false; ability &= ~dockAbility; DockingManager.SetDockAbility(element, ability); } else { item.IsChecked = true; ability |= dockAbility; DockingManager.SetDockAbility(element, ability); } }