Back to Devexpress

MiniMap.Behavior Property

windowsforms-devexpress-dot-xtramap-dot-minimap-94e16b64.md

latest3.0 KB
Original Source

MiniMap.Behavior Property

Gets or sets the behavior of a mini map.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
[DefaultValue(null)]
public MiniMapBehavior Behavior { get; set; }
vb
<DefaultValue(Nothing)>
Public Property Behavior As MiniMapBehavior

Property Value

TypeDefaultDescription
MiniMapBehaviornull

A MiniMapBehavior class descendant object.

|

Remarks

For more information about mini maps, refer to the Mini Map topic.

Example

This example shows how to customize mini map behavior.

To do this, assign the MiniMapBehavior class descendant object to the MiniMap.Behavior property and specify the object’s properties.

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 cbBehavior_SelectedIndexChanged(object sender, EventArgs e) {
    MiniMapBehavior behavior = cbBehavior.SelectedValue as MiniMapBehavior;
    if (behavior == null) return;
    propertyGrid.SelectedObject = behavior;

    if (mapControl.MiniMap == null) return;
    mapControl.MiniMap.Behavior = behavior;

}
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 cbBehavior_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles cbBehavior.SelectedIndexChanged
    Dim behavior As MiniMapBehavior = TryCast(cbBehavior.SelectedValue, MiniMapBehavior)
    If behavior Is Nothing Then
        Return
    End If
    propertyGrid.SelectedObject = behavior

    If mapControl.MiniMap Is Nothing Then
        Return
    End If
    mapControl.MiniMap.Behavior = behavior

End Sub

See Also

MiniMap Class

MiniMap Members

DevExpress.XtraMap Namespace