Exemplo n.º 1
0
        private static object CoerceMaxHeight(DependencyObject d, object value)
        {
            TabControlEx tc       = (TabControlEx)d;
            double       newValue = (double)value;

            if (newValue < tc.TabItemMinHeight)
            {
                return(tc.TabItemMinHeight);
            }

            return(newValue);
        }
Exemplo n.º 2
0
        private static object CoerceMinWidth(DependencyObject d, object value)
        {
            TabControlEx tc       = (TabControlEx)d;
            double       newValue = (double)value;

            if (newValue > tc.TabItemMaxWidth)
            {
                return(tc.TabItemMaxWidth);
            }

            return(newValue > 0 ? newValue : 0);
        }
Exemplo n.º 3
0
        private void Close(object o, RoutedEventArgs e)
        {
            TabControlEx tabControl = WpfExtensions.FindVisualParent <TabControlEx>(this);

            if (tabControl == null)
            {
                return;
            }

            tabControl.RemoveItem(this);

            //after remove the item from the tabcontrol,detach the hander from the click event
            this._closeButton.Click -= new RoutedEventHandler(Close);
        }
Exemplo n.º 4
0
        /// <summary>
        /// OnMinMaxChanged callback responds to any of the Min/Max dependancy properties changing
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnMinMaxChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TabControlEx tc = (TabControlEx)d;

            if (tc.Template == null)
            {
                return;
            }

            foreach (TabItemEx child in tc.InternalChildren())
            {
                if (child != null)
                {
                    child.Dimension = null;
                }
            }

            if (tc._tabPanel != null)
            {
                tc._tabPanel.InvalidateMeasure();
            }
        }
Exemplo n.º 5
0
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);

            _tabControl = base.TemplatedParent as TabControlEx;
        }