private void ChangeTabVisibleCore() { RadRibbonBarElement parent = this.Owner.Parent as RadRibbonBarElement; if (parent == null) { return; } parent.SuspendPropertyNotifications(); parent.ElementTree.RootElement.SuspendLayout(); bool expanded = parent.Expanded; parent.Expanded = true; CommandTabEventArgs args = new CommandTabEventArgs(this); parent.CallOnCommandTabCollapsed(args); parent.VisibleChangedCore(); parent.Expanded = expanded; parent.ElementTree.RootElement.ResumeLayout(false); parent.ResumePropertyNotifications(); }
protected override void OnPropertyChanging(RadPropertyChangingEventArgs e) { base.OnPropertyChanging(e); if (e.Property == RadItem.VisibilityProperty && ((ElementVisibility)e.NewValue) == ElementVisibility.Collapsed) { int indexOfCurrentTab = this.Owner.Items.IndexOf(this); bool selectedTabChanged = false; for (int i = indexOfCurrentTab + 1; i < this.Owner.Items.Count; i++) { RadPageViewItem currentItem = this.Owner.Items[i] as RadPageViewItem; if (currentItem.Visibility == ElementVisibility.Visible) { this.Owner.SelectedItem = currentItem; selectedTabChanged = true; break; } } if (!selectedTabChanged) { for (int i = indexOfCurrentTab - 1; i > -1; i--) { RadPageViewItem currentItem = this.Owner.Items[i] as RadPageViewItem; if (currentItem.Visibility == ElementVisibility.Visible) { this.Owner.SelectedItem = currentItem; selectedTabChanged = true; break; } } } e.Cancel = !selectedTabChanged; if (!e.Cancel) { RadRibbonBarElement ribbonBar = this.Owner.Parent as RadRibbonBarElement; if (ribbonBar != null) { CommandTabEventArgs args = new CommandTabEventArgs(this); ribbonBar.CallOnCommandTabCollapsed(args); } } this.Owner.InvalidateMeasure(); this.Owner.InvalidateArrange(); this.Owner.UpdateLayout(); } else if (e.Property == RadItem.VisibilityProperty && ((ElementVisibility)e.NewValue) == ElementVisibility.Visible) { RadRibbonBarElement ribbonBar = this.Owner.Parent as RadRibbonBarElement; if (ribbonBar != null) { CommandTabEventArgs args = new CommandTabEventArgs(this); ribbonBar.CallOnCommandTabExpanded(args); ribbonBar.TabStripElement.SelectedItem = this; } } }