Пример #1
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)
        {
            TabControl tc = (TabControl)d;

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

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


            //            var tabsCount = tc.GetTabsCount();
            //            for (int i = 0; i < tabsCount; i++)
            //            {
            //                Header ti = tc.GetTabItem(i);
            //                if (ti != null)
            //                    ti.Dimension = null;
            //            }

            TabPanel tp = Helper.FindVirtualizingTabPanel(tc);

            if (tp != null)
            {
                tp.InvalidateMeasure();
            }
        }
Пример #2
0
        /// <summary>
        /// OnTabStripPlacementChanged property callback
        /// </summary>
        /// <remarks>
        ///     We need to supplement the base implementation with this method as the base method does not work when
        ///     we are using virtualization in the tabpanel, it only updates visible items
        /// </remarks>
        private static void OnTabStripPlacementChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TabControl tc = (TabControl)d;

            foreach (TabItem tabItem in tc.InternalChildren())
            {
                if (tabItem != null)
                {
                    tabItem.Dimension = null;
                    tabItem.CoerceValue(System.Windows.Controls.TabItem.TabStripPlacementProperty);
                }
            }
        }