Example #1
0
        /// <summary>
        /// Adds a new gallery to the specified <see cref="ItemsControl" />.
        /// </summary>
        /// <param name="itemsControl">The items control.</param>
        /// <param name="items">The list of items.</param>
        /// <param name="orientation">The gallery orientation.</param>
        /// <param name="selectable">if set to <c>true</c> is selectable.</param>
        /// <param name="itemWidth">Width of the item.</param>
        /// <param name="itemHeight">Height of the item.</param>
        /// <param name="minItemsInRow">The min items in row.</param>
        /// <param name="maxItemsInRow">The max items in row.</param>
        /// <param name="itemContainerStyle">The item container style.</param>
        /// <returns>
        /// The created gallery.
        /// </returns>
        public static Gallery AddGallery(this ItemsControl itemsControl, IEnumerable <IRibbonItem> items, Orientation orientation, bool selectable,
                                         double itemWidth = double.NaN, double itemHeight = double.NaN, int minItemsInRow = 2, int maxItemsInRow = 16, Style itemContainerStyle = null)
        {
            Argument.IsNotNull("itemsControl", itemsControl);
            Argument.IsNotNull("items", items);

            var gallery = new Gallery
            {
                Orientation   = orientation,
                Selectable    = selectable,
                MinItemsInRow = minItemsInRow,
                MaxItemsInRow = maxItemsInRow,
                ItemWidth     = itemWidth,
                ItemHeight    = itemHeight,
                //ItemContainerStyle = itemContainerStyle,
            };

            foreach (var ribbonItem in items)
            {
                gallery.AddRibbonItem(ribbonItem);
            }

            itemsControl.Items.Add(gallery);

            return(gallery);
        }