RemoveTabItem() публичный Метод

Called by a child Header that wants to remove itself by clicking on the close button
public RemoveTabItem ( TabItem tabItem, System.Boolean allowReopening = true, System.Boolean isCloseLastTab = false ) : void
tabItem TabItem
allowReopening System.Boolean
isCloseLastTab System.Boolean
Результат void
Пример #1
0
        /// <summary>
        /// OnApplyTemplate override
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // wire up the CloseButton's Click event if the button exists
            ButtonBase button = this.Template.FindName("PART_CloseButton", this) as ButtonBase;

            if (button != null)
            {
                button.PreviewMouseLeftButtonDown += (sender, e) => {
                    // get the parent tabcontrol
                    TabControl tc = Helper.FindParentControl <TabControl>(this);

                    if (tc == null)
                    {
                        return;
                    }
                    // remove this tabitem from the parent tabcontrol
                    tc.RemoveTabItem(this);
                };
            }
            this.PreviewMouseLeftButtonUp += TabItem_PreviewMouseLeftButtonUp;
            this.PreviewMouseDoubleClick  += TabItem_PreviewMouseDoubleClick;
            this.MouseRightButtonUp       += TabItem_MouseRightButtonUp;
        }
Пример #2
0
        /// <summary>
        /// OnApplyTemplate override
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // wire up the CloseButton's Click event if the button exists
            ButtonBase button = this.Template.FindName("PART_CloseButton", this) as ButtonBase;

            if (button != null)
            {
                button.Click += delegate
                {
                    // get the parent tabcontrol
                    TabControl tc = Helper.FindParentControl <TabControl>(this);
                    if (tc == null)
                    {
                        return;
                    }

                    // remove this tabitem from the parent tabcontrol
                    tc.RemoveTabItem(this);

                    string curHeader = this.Header.ToString();
                    switch (curHeader)
                    {
                    case "Work in Progress":
                        Wpf.Controls.TabControl.isAdded.Set((int)Wpf.Controls.TabControl.Section.WIP, false);
                        break;

                    case "Inventory":
                        Wpf.Controls.TabControl.isAdded.Set((int)Wpf.Controls.TabControl.Section.INV, false);
                        break;

                    case "In-/OutBound":
                        Wpf.Controls.TabControl.isAdded.Set((int)Wpf.Controls.TabControl.Section.INOUT, false);
                        break;

                    case "Reporting":
                        Wpf.Controls.TabControl.isAdded.Set((int)Wpf.Controls.TabControl.Section.REPORT, false);
                        break;

                    case "Tasks":
                        Wpf.Controls.TabControl.isAdded.Set((int)Wpf.Controls.TabControl.Section.TASKS, false);
                        break;

                    case "Billing":
                        Wpf.Controls.TabControl.isAdded.Set((int)Wpf.Controls.TabControl.Section.BILL, false);
                        break;

                    case "Admin":
                        Wpf.Controls.TabControl.isAdded.Set((int)Wpf.Controls.TabControl.Section.ADMIN, false);
                        break;

                    default:
                        break;
                    }
                };
            }
        }
Пример #3
0
        /// <summary>
        /// OnApplyTemplate override
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // wire up the CloseButton's Click event if the button exists
            ButtonBase button = this.Template.FindName("PART_CloseButton", this) as ButtonBase;

            if (button != null)
            {
                button.Click += delegate
                {
                    // get the parent tabcontrol
                    TabControl tc = Helper.FindParentControl <TabControl>(this);
                    if (tc == null)
                    {
                        return;
                    }

                    // remove this tabitem from the parent tabcontrol
                    tc.RemoveTabItem(this);
                };
            }
        }