windowsforms-devexpress-dot-xtraeditors-dot-svgimageitem-dda87e45.md
Gets or sets the item’s unique identifier. The SVG image format allows IDs to be assigned to items via the id attribute.
Namespace : DevExpress.XtraEditors
Assembly : DevExpress.Utils.v25.2.dll
NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core
public string Id { get; set; }
Public Property Id As String
| Type | Description |
|---|---|
| String |
The item’s ID.
|
The SVG format defines the optional id attribute to assign unique names to image elements.
<g id="seat_82">
<g id="background_normal_82">
The SvgImageItem.Id property allows you to obtain this attribute’s value and assign a custom ID.
If the id attribute is missing, the Id property returns null.
The image designer shows items’ IDs in angle brackets and in the Property Grid (when you select a specific item).
If you assign a non-unique value to the Id property, the control raises an exception (DevExpress.XtraEditors.InvalidIdentifierException).
Note
The SVG format specification allows elements to be re-used via the “use” element. The use element references another element and indicates that the graphical contents of that element are included at that given point. Instead of an element defined with the use attribute, the SVGImageBox control creates a group which encapsulates the referenced element. The Id s of this element and all its children are set to null to avoid duplicate IDs.
The following code searches for items whose IDs start with the “background_pressed” sub-string and then hides these items.
var items = svgImageBox1.FindItems(item => item.Id != null && item.Id.StartsWith("background_pressed"));
items.ForEach(item => item.Visible = false);
Dim items = SvgImageBox1.FindItems(Function(item) item.Id IsNot Nothing AndAlso item.Id.StartsWith("background_pressed"))
items.ForEach(Sub(item) item.Visible = False)
See Also