示例#1
0
        private static void OnGroupStylesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ItemsControl itemsControl = d as ItemsControl;

            if (itemsControl != null)
            {
                itemsControl.GroupStyle.Clear();
                GroupStyleCollection groupStyles = e.NewValue as GroupStyleCollection;
                if (groupStyles != null)
                {
                    // itemsControl.GroupStyle.AddRange (groupStyles); ** Uncomment when we have C# 3.0 support **
                    Extensions.AddRange(itemsControl.GroupStyle, groupStyles);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Called when the group styles property is changed.
        /// </summary>
        /// <param name="dependencyObject">The dependency object.</param>
        /// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
        private static void OnGroupStylesPropertyChanged(
            DependencyObject dependencyObject,
            DependencyPropertyChangedEventArgs e)
        {
            ItemsControl itemsControl = (ItemsControl)dependencyObject;

            GroupStyleCollection groupStyles = GetGroupStyles(itemsControl);

            if (groupStyles != null)
            {
                itemsControl.GroupStyle.Clear();
                foreach (GroupStyle groupStyle in groupStyles)
                {
                    itemsControl.GroupStyle.Add(groupStyle);
                }
            }
        }
示例#3
0
 /// <summary>
 /// Sets the value of the <see cref="GroupStylesProperty"/> attached property for a specified <see cref="ItemsControl"/>.
 /// </summary>
 /// <param name="itemsControl">The items control to which the attached property is written.</param>
 /// <param name="groupStyles">The group styles.</param>
 public static void SetGroupStyles(ItemsControl itemsControl, GroupStyleCollection groupStyles)
 {
     itemsControl.SetValue(Extensions.GroupStylesProperty, groupStyles);
 }
示例#4
0
 /// <summary>
 /// Sets the group style attached via the <see cref="P:TomsToolbox.Wpf.StyleBindings.GroupStyles"/> attached property.
 /// </summary>
 /// <param name="obj">The object the group style is attached to.</param>
 /// <param name="value">The group styles.</param>
 public static void SetGroupStyles([NotNull] DependencyObject obj, [CanBeNull, ItemNotNull] GroupStyleCollection value)
 {
     obj.SetValue(GroupStylesProperty, value);
 }
 /// <summary>
 /// Sets the group styles.
 /// </summary>
 /// <param name="itemsControl">The items control.</param>
 /// <param name="value">The value.</param>
 public static void SetGroupStyles(ItemsControl itemsControl, GroupStyleCollection value)
 {
     itemsControl.SetValue(GroupStylesProperty, value);
 }
示例#6
0
 /// <summary>
 /// Sets the group styles.
 /// </summary>
 /// <param name="itemsControl">The items control.</param>
 /// <param name="value">The value.</param>
 public static void SetGroupStyles(ItemsControl itemsControl, GroupStyleCollection value)
 {
     itemsControl.SetValue(GroupStylesProperty, value);
 }
示例#7
0
        /// <summary>
        /// Sets the group style attached via the <see cref="P:TomsToolbox.Wpf.StyleBindings.GroupStyles"/> attached property.
        /// </summary>
        /// <param name="obj">The object the group style is attached to.</param>
        /// <param name="value">The group styles.</param>
        public static void SetGroupStyles([NotNull] DependencyObject obj, [CanBeNull, ItemNotNull] GroupStyleCollection value)
        {
            Contract.Requires(obj != null);

            obj.SetValue(GroupStylesProperty, value);
        }