Skip to main content
A newer version of this page is available. .
Bar

BarItem.ImageUri Property

Gets or sets the uniform resource identifier of the image in the DX Image Gallery displayed in the current item. 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.v18.2.dll

Declaration

[Browsable(false)]
public virtual DxImageUri ImageUri { get; set; }

Property Value

Type Description
DevExpress.Utils.DxImageUri

A DevExpress.Utils.DxImageUri object that specifies the uniform resource identifier of the image to be displayed in the current item.

Remarks

The ImageUri property allows you to provide an icon for the current item from the DX Image Gallery using a uniform resource identifier. The DevExpress.Utils.DxImageUri.Uri property specifies a string value that is the common name of the required image in the DX Image Gallery. The actual version of the specified image displayed by the item will be dependent on the current application context (the current skin and required image size).

At design time, to select the required icon for the current item, you can invoke the Image Picker using the smart tag menu. When the icon is selected, the Uri property is automatically specified. See the figure below.

BarItem_ImageURI

You can also use the Properties window to specify the ImageUri property at design time. In code, you can specify the ImageUri property as in the code snippet below.


barButtonItem1.ImageUri.Uri = "SaveAll";

If the ImageUri property is specified, the palette of the required icon is automatically determined based on the currently applied skin. For instance, in the Office 2013 skins, the flat icon, as in the previous figure, is displayed. In other skins, the colored or gray-scaled version of this icon is used.

The size of the displayed icon is also determined automatically depending on the use case. For instance, the same button in the Ribbon Control can display either a large or small icon. The Ribbon Control supports automatic replacement of button large images with small ones when the control’s width is reduced. When an image is assigned to a button with the ImageUri property, the large or small version of the image will be automatically chosen from the DX Image Gallery according to the required image size.

The ImageUri property has priority over the BarItem.Glyph, BarItem.LargeGlyph, BarItem.ImageIndex and BarItem.LargeImageIndex properties.

See Also