Gallery
27 Sep 201717 minutes to read
Galleries are used to display items that can be arranged in a grid-type layout. Items in the gallery can be customized as Button/Menu
to display images, text, or both images and text. You can set Type
of group as Gallery
.
Gallery Items
Gallery items are collection of the items to be included in the main gallery. You can set Text
and ToolTip
to gallery item which can also be customized with ButtonSettings
.
Number of Columns
to display in gallery for each row should be specified and the Number of columns in Expanded State (ExpandedColumns
) can be customized, if not set, Columns
count will be set as default.
NOTE
The
ItemHeight
andItemWidth
for gallery item can be set, if not set default values will be used.
@(Html.EJ().Ribbon("defaultRibbon")
.Width("500")
.ApplicationTab(app =>
{
app.Type(ApplicationTabType.Menu).MenuItemID("ribbon");
})
.RibbonTabs(tab =>
{
tab.Id("home").Text("HOME").TabGroups(tabgroup =>
{
tabgroup.Text("Gallery").Type("gallery").Content(ctn =>
{
ctn.ContentGroups(contentGroup =>
{
contentGroup.Id("Gallery").Type(RibbonButtonType.Gallery).ItemWidth("73").ItemHeight("54").Columns(2).ExpandedColumns(3).GalleryItems(gallery =>
{
gallery.Text("GalleryContent1").ToolTip("GalleryContent1").ButtonSettings(new ButtonProperties()
{
ContentType = ContentType.ImageOnly,
PrefixIcon = "e-icon e-gallerycontent1 e-gbtnimg",
CssClass = "e-gbtnposition"
}).Add();
gallery.Text("GalleryContent2").ToolTip("GalleryContent2").ButtonSettings(new ButtonProperties()
{
ContentType = ContentType.ImageOnly,
PrefixIcon = "e-icon e-gallerycontent2 e-gbtnimg",
CssClass = "e-gbtnposition"
}).Add();
gallery.Text("GalleryContent3").ToolTip("GalleryContent3").ButtonSettings(new ButtonProperties()
{
ContentType = ContentType.ImageOnly,
PrefixIcon = "e-icon e-gallerycontent3 e-gbtnimg",
CssClass = "e-gbtnposition"
}).Add();
gallery.Text("GalleryContent4").ToolTip("GalleryContent4").ButtonSettings(new ButtonProperties()
{
ContentType = ContentType.ImageOnly,
PrefixIcon = "e-icon e-gallerycontent4 e-gbtnimg",
CssClass = "e-gbtnposition"
}).Add();
}).Add();
}).Add();
}).Add();
}).Add();
})
)
<ul id="ribbon">
<li>
<a>FILE</a>
<ul>
<li><a>Open</a></li>
</ul>
</li>
</ul>
@section StyleSection{
<link href="~/Content/ej/ribbon-css/ej.icons.css" rel="stylesheet" />
<style type="text/css">
.e-gallerycontent1 {
background-position: 0 -105px;
}
.e-gallerycontent2 {
background-position: -69px -105px;
}
.e-gallerycontent3 {
background-position: -136px -105px;
}
.e-gallerycontent4 {
background-position: 0 -53px;
}
.e-gbtnposition {
margin-top: 5px;
}
.e-gbtnimg {
background-image: url("../Content/ej/common-images/ribbon/homegallery.png");
background-repeat: no-repeat;
height: 64px;
width: 64px;
}
</style>
}
Ribbon Gallery.
Gallery at Expanded State
Custom Gallery Items
Custom gallery items are the additional items to be displayed at gallery expanded state. You can set CustomItemType
as Button
or Menu
, Default is Button
.
You can also set Text
and ToolTip
to custom gallery item which can also be customized with ButtonSettings/MenuSettings based on the CustomItemType specified.
@(Html.EJ().Ribbon("defaultRibbon")
.Width("500")
.ApplicationTab(app =>
{
app.Type(ApplicationTabType.Menu).MenuItemID("ribbon");
})
.RibbonTabs(tab =>
{
tab.Id("home").Text("HOME").TabGroups(tabgroup =>
{
tabgroup.Text("Gallery").Type("gallery").Content(ctn =>
{
ctn.ContentGroups(contentGroup =>
{
contentGroup.Id("Gallery").Type(RibbonButtonType.Gallery).ItemWidth("73").ItemHeight("54").Columns(2).ExpandedColumns(3).GalleryItems(gallery =>
{
gallery.Text("GalleryContent1").ToolTip("GalleryContent1").ButtonSettings(new ButtonProperties(){
ContentType=ContentType.ImageOnly,
PrefixIcon="e-icon e-gallerycontent1 e-gbtnimg",
CssClass="e-gbtnposition"
}).Add();
gallery.Text("GalleryContent2").ToolTip("GalleryContent2").ButtonSettings(new ButtonProperties()
{
ContentType = ContentType.ImageOnly,
PrefixIcon = "e-icon e-gallerycontent2 e-gbtnimg",
CssClass = "e-gbtnposition"
}).Add();
gallery.Text("GalleryContent3").ToolTip("GalleryContent3").ButtonSettings(new ButtonProperties()
{
ContentType = ContentType.ImageOnly,
PrefixIcon = "e-icon e-gallerycontent3 e-gbtnimg",
CssClass = "e-gbtnposition"
}).Add();
gallery.Text("GalleryContent4").ToolTip("GalleryContent4").ButtonSettings(new ButtonProperties()
{
ContentType = ContentType.ImageOnly,
PrefixIcon = "e-icon e-gallerycontent4 e-gbtnimg",
CssClass = "e-gbtnposition"
}).Add();
}).CustomGalleryItems(customGallery =>
{
customGallery.CustomItemType(CustomItemType.Menu).MenuId("customMenu").MenuSettings(new MenuProperties()
{
OpenOnClick = false
}).Add();
customGallery.Text("Clear Formatting").ToolTip("Clear Formatting").CustomItemType(CustomItemType.Button).ButtonSettings(new ButtonProperties()
{
CssClass = "e-extrabtnstyle"
}).Add();
}).Add();
}).Add();
}).Add();
}).Add();
})
)
<ul id="ribbon">
<li>
<a>FILE</a>
</li>
</ul>
<ul id="customMenu">
<li>
<a>New Quick Step</a>
<ul>
<li>
<a>Flag & Move</a>
</li>
</ul>
</li>
</ul>
@section StyleSection{
<link href="~/Content/ej/ribbon-css/ej.icons.css" rel="stylesheet" />
<style type="text/css">
.e-gallerycontent1{
background-position: 0 -105px;
}
.e-gallerycontent2{
background-position: -69px -105px;
}
.e-gallerycontent3{
background-position: -136px -105px;
}
.e-gallerycontent4{
background-position: 0 -53px;
}
.e-gbtnposition{
margin-top:5px;
}
.e-gbtnimg{
background-image: url("../Content/ej/common-images/ribbon/homegallery.png");
background-repeat:no-repeat;
height:64px;
width:64px;
}
.e-extracontent .e-extrabtnstyle{
padding-left: 28px;
text-align: left;
}
.e-pastetip {
background-image: url("../Content/ej/common-images/ribbon/paste.png");
background-repeat: no-repeat;
height: 64px;
width: 64px;
}
</style>