windowsforms-devexpress-dot-xtrabars-dot-baritem-c33c1a3f.md
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.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[Browsable(false)]
public virtual DxImageUri ImageUri { get; set; }
<Browsable(False)>
Public Overridable Property ImageUri As DxImageUri
| 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.
|
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:
Note
The ImageUri property has priority over the Image, LargeImage,ImageIndex and LargeImageIndex properties.
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";
barButtonItem1.ImageOptions.ImageUri.Uri = "SaveAll"
barButtonItem2.ImageOptions.ImageUri.Uri = "Close;Size32x32;Office2013"
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";
barButtonItem1.ImageOptions.ImageUri.ResourceType = GetType(MyNamespace.MyClass)
barButtonItem1.ImageOptions.ImageUri.Uri = "AnyStringPrefix://MyNamespace.Resources.ImageName.png"
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";
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"
See Also