Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Loading...

Recommended reading 

Introduction

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

CopyC#
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() : base("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 Setting("numberOfColumns", 1));
            Settings.Add(new Setting("showToolbar", true));
            Settings.Add(new Setting("containerUnlocked", false));
            Settings.Add(new Setting("closable", false));
            Settings.Add(new PersonalizableSetting("componentCategory"));
        }

        /// <summary>
        /// Gets or sets a comma seperated string of categories that this component can have as children.
        /// </summary>
        public virtual string ComponentCategory
        {
            get
            {
                return Settings["componentCategory"] as string;
            }
            set
            {
                Settings["componentCategory"] = value;
            }
        }
    }
}
Do you find this information helpful? Please log in to provide feedback.

Last updated: Mar 21, 2013

Recommended reading