Back to Devexpress

MiniMap.Alignment Property

windowsforms-devexpress-dot-xtramap-dot-minimap-b713b4f3.md

latest4.5 KB
Original Source

MiniMap.Alignment Property

Gets or sets the alignment of a mini map.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
[DefaultValue(MiniMapAlignment.BottomLeft)]
public MiniMapAlignment Alignment { get; set; }
vb
<DefaultValue(MiniMapAlignment.BottomLeft)>
Public Property Alignment As MiniMapAlignment

Property Value

TypeDefaultDescription
MiniMapAlignmentBottomLeft

A MiniMapAlignment enumeration value.

|

Available values:

NameDescription
TopLeft

A mini map aligned to the top-left corner of a map.

| | TopRight |

A mini map aligned to the top-right corner of a map.

| | BottomLeft |

A mini map aligned to the bottom-left corner of a map.

| | BottomRight |

A mini map aligned to the bottom-right corner of a map.

|

Example

To customize a mini map’s alignment, set the MiniMap.Alignment property to the MiniMapAlignment enumeration value.

csharp
List<MiniMapBehavior> behaviors = new List<MiniMapBehavior> { 
    new FixedMiniMapBehavior(), 
    new DynamicMiniMapBehavior()
};

private void Form1_Load(object sender, EventArgs e) {
    cbAlignment.DataSource = Enum.GetValues(typeof(MiniMapAlignment));
    cbBehavior.DataSource = behaviors;
}
private void cbAlignment_SelectedIndexChanged(object sender, EventArgs e) {
    MiniMapAlignment alignment = (MiniMapAlignment)cbAlignment.SelectedValue;
    if (mapControl.MiniMap == null) return;
    mapControl.MiniMap.Alignment = alignment;
}
vb
Private behaviors As New List(Of MiniMapBehavior)() From { _
    New FixedMiniMapBehavior(), _
    New DynamicMiniMapBehavior() _
}

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
    cbAlignment.DataSource = System.Enum.GetValues(GetType(MiniMapAlignment))
    cbBehavior.DataSource = behaviors
End Sub
Private Sub cbAlignment_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles cbAlignment.SelectedIndexChanged
    Dim alignment As MiniMapAlignment = DirectCast(cbAlignment.SelectedValue, MiniMapAlignment)
    If mapControl.MiniMap Is Nothing Then
        Return
    End If
    mapControl.MiniMap.Alignment = alignment
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Alignment property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-map-bind-to-xml-data/CS/WinForms_MapControl_ListAdapter/Form1.cs#L32

csharp
MiniMap miniMap = new MiniMap();
miniMap.Alignment = MiniMapAlignment.BottomLeft;
miniMap.Layers.AddRange(new MiniMapLayerBase[] {

winforms-map-bind-to-xml-data/VB/WinForms_MapControl_ListAdapter/Form1.vb#L29

vb
Dim miniMap As MiniMap = New MiniMap()
miniMap.Alignment = MiniMapAlignment.BottomLeft
miniMap.Layers.AddRange(New MiniMapLayerBase() {New MiniMapImageTilesLayer() With {.DataProvider = New AzureMapDataProvider() With {.AzureKey = "YOUR_azure_MAPS_KEY_HERE"}}, New MiniMapVectorItemsLayer() With {.Data = CreateMiniMapAdapter(data)}})

See Also

MiniMap Class

MiniMap Members

DevExpress.XtraMap Namespace