Skip to main content

MapOverlayItemBase.Alignment Property

Gets or sets the alignment of the overlay item.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v23.1.dll

NuGet Package: DevExpress.Win.Map


public ContentAlignment Alignment { get; set; }

Property Value

Type Default Description
ContentAlignment TopLeft

A ContentAlignment enumeration value.


You can use this property to align two or more items within the overlay. Note that, the overlay does not consider the item’s Alignment property then the Location property is set.


This example demonstrates how to implement a map overlay that looks like a button with an icon:

Overlay Item Alignment Sample

// In the Form_Load event handler.
MapOverlay overlay = CreateButtonLikeOverlay(
    image: LoadOkIconFromResources(),
    text: "OK"
overlay.Alignment = ContentAlignment.TopLeft;
overlay.Margin = new Padding(16);
// ...

private MapOverlay CreateButtonLikeOverlay(Image image, String text) {
    MapOverlay overlay = new MapOverlay();
    overlay.Padding = new Padding(8);
    overlay.Items.Add(new MapOverlayTextItem {
        Text = text,
        Alignment = ContentAlignment.MiddleRight
    overlay.Items.Add(new MapOverlayImageItem {
        Image = image,
        Alignment = ContentAlignment.MiddleLeft
    return overlay;
See Also