DevExpress Image Gallery
- 2 minutes to read
The Image Gallery is a special predefined collection populated with images from:
- the application’s solution;
- the DevExpress.Images.v18.2.dll assembly, which contains images used in DevExpress controls.
This topic consists of the following sections:
Specifying Images at Design Time
Follow the steps below to specify an image at design time:
- Click the smart tag button of the element for which you want to specify an image.
- Click the image property’s button.
- Choose the required image from the Image Gallery.
- Click OK.
Specifying Images in Code
In Markup
The code sample below demonstrates how to specify images in markup:
<dxr:RibbonControl>
<dxr:RibbonDefaultPageCategory>
<dxr:RibbonPage Caption="Home">
<dxr:RibbonPageGroup>
<dxb:BarButtonItem Content="Open"
Glyph="{dxc:DXImage Image=Open_16x16.png}"
LargeGlyph="{dxc:DXImage Image=Open_32x32.png}"
RibbonStyle="Large"/>
<dxb:BarButtonItem Content="New"
Glyph="{dxc:DXImage Image=New_16x16.png}"
LargeGlyph="{dxc:DXImage Image=New_32x32.png}"
RibbonStyle="Large"/>
</dxr:RibbonPageGroup>
</dxr:RibbonPage>
</dxr:RibbonDefaultPageCategory>
</dxr:RibbonControl>
The image below shows the result:
In Code-Behind
Use the following methods to get an image from the Image Gallery:
Method | Description |
---|---|
DXImageHelper.GetImageSource | Retrieves the specified image from the library. |
DXImageHelper.GetImageUri | Returns a Uri that defines the specified image’s location. |
The following code sample demonstrates how to specify images in code-behind:
BarButtonItem bOpen = new BarButtonItem {
Content = "Open",
Glyph = DXImageHelper.GetImageSource("Open", ImageSize.Size16x16),
LargeGlyph = DXImageHelper.GetImageSource("Open", ImageSize.Size32x32),
RibbonStyle = RibbonItemStyles.Large
};
BarButtonItem bNew = new BarButtonItem {
Content = "New",
Glyph = DXImageHelper.GetImageSource("New", ImageSize.Size16x16),
LargeGlyph = DXImageHelper.GetImageSource("New", ImageSize.Size32x32),
RibbonStyle = RibbonItemStyles.Large
};
See Also