BarItem.ImageUri Property
Gets or sets a uniform resource identifier of an image from the DX Image Gallery displayed in the current item. An A specific version of the addressed image is automatically chosen based on the app context (the current skin and required image size).
Namespace: DevExpress.XtraBars
Assembly: DevExpress.XtraBars.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
Property Value
Type | Description |
---|---|
DevExpress.Utils.DxImageUri | A DevExpress.Utils.DxImageUri object that specifies a uniform resource identifier of an image to be displayed in the current item. |
Remarks
The DxImageUri
type represents an image that is specified by a uriform resource indentifier (URI). A DxImageUri
object can be accessed through the ImageOptions.ImageUri
property of a DevExpress control. To specify an image, you can use the following identifiers:
- a unique name of an image in the DX Image Gallery,
- a resource in an assembly,
- an absolute or relative path to a file on a disk.
Note
The ImageUri
property has priority over the Image
, LargeImage
,ImageIndex
and LargeImageIndex
properties.
An image in the DX Image Gallery
Use the ImageUri
property editor to specify the URI of an image in the DX Image Gallery.
If you do not specify the required size or type (Any size, Default type), the actually displayed image depends on the application context. For instance, flat icons are displayed in the Office 2013 skins, small images are displayed when there is no place to display large icons.
To specify a URI in code, use the ImageOptions.ImageUri.Uri
property. To specify the required size, use the Size16x16
and Size32x32
modifiers. To specify the style, use the Colored
, GrayScaled
and Office2013
modifiers. Separate modifiers with ;
or ,
. If the specified URI is not valid, no exception is thrown.
barButtonItem1.ImageOptions.ImageUri.Uri = "SaveAll";
barButtonItem2.ImageOptions.ImageUri.Uri = "Close;Size32x32;Office2013";
An image in an assembly
Use the ResourceType
property to specify a type defined in an assembly that contains required resources.
barButtonItem1.ImageOptions.ImageUri.ResourceType = typeof(MyNamespace.MyClass);
barButtonItem1.ImageOptions.ImageUri.Uri = "AnyStringPrefix://MyNamespace.Resources.ImageName.png";
A file on a disk
You can specify a full or relative path to a vector or a bitmap image. You can also specify a path to a folder with images, and use the following keys to specify the required image:
- the
name
key to specify the file name, - the
format
key to specify the file extention, - the
size
key to specify the required size (side of a square) if you use a vector image.
barButtonItem1.ImageOptions.ImageUri.Uri = "image.bmp";
barButtonItem1.ImageOptions.ImageUri.Uri = "file://D:/images/save.bmp";
barButtonItem1.ImageOptions.ImageUri.Uri = "D://images/?name=save&format=bmp";
barButtonItem1.ImageOptions.ImageUri.Uri = "file://D:/images/?name=save&format=svg&size=32";