예제 #1
0
 /// <summary>
 /// Invoked when the System.Windows.Controls.ItemsControl.Items property changes.
 /// </summary>
 /// <param name="e">Information about the change.</param>
 protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (e.NewItems != null)
     {
         foreach (Visual visual in e.NewItems)
         {
             RibbonControl.SetAppropriateSize((UIElement)visual, State);
         }
     }
     base.OnItemsChanged(e);
 }
예제 #2
0
        static void SetAppropriateSizeRecursive(UIElement root, RibbonGroupBoxState ribbonGroupBoxState)
        {
            if (root == null) return;
            if (root is RibbonControl)
            {
                RibbonControl.SetAppropriateSize(root, ribbonGroupBoxState);
                return;
            }

            int childrenCount = VisualTreeHelper.GetChildrenCount(root);
            for (int i = 0; i < childrenCount; i++)
            {
                SetAppropriateSizeRecursive(VisualTreeHelper.GetChild(root, i) as UIElement, ribbonGroupBoxState);
            }
        }