London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Loading...
Area: Optimizely CMS
ARCHIVED This content is retired and no longer maintained. See the latest version here.

The following example shows how to create the component container used for adding personalized gadgets.

C#
using System;
using System.Collections.Generic;

namespace EPiServer.Shell.ViewComposition.Containers
{
    /// <summary>
    /// An extension of the grid container providing component management
    /// </summary>
    [Component(IsAvailableForUserSelection = false)]
    public class ComponentContainer : ContainerBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ComponentContainer"/> class.
        /// </summary>
        public ComponentContainer() : this("epi.shell.widget.layout.ComponentContainer") { }

        /// <summary>
        /// Initializes a new instance of the <see cref="ComponentContainer"/> class.
        /// </summary>
        protected ComponentContainer(string widgetType) : base(widgetType)
        { 
            Settings.Add(new PersonalizableSetting("numberOfColumns", 1));
            Settings.Add(new Setting("showToolbar", true));
            Settings.Add(new Setting("containerUnlocked", false));
            Settings.Add(new Setting("closable", false));
            Settings.Add(new Setting("personalizableHeading", string.Empty, true));
        }

        /// <summary>
        /// Gets or sets the categories that should be suggested for users for this container.
        /// </summary>
        [Obsolete("Categories are now defined on the view level, and not per container.")]
        public virtual string ComponentCategory
        {
            get
            {
                return null;
            }
            set
            {
            }
        }
    }
}

Last updated: Sep 21, 2015