NavigationPanelOptions.XCoordinatePattern Property
Gets or sets the pattern of the string representation of the X coordinate.
Namespace: DevExpress.XtraMap
Assembly: DevExpress.XtraMap.v24.1.dll
NuGet Package: DevExpress.Win.Map
Declaration
Property Value
Type | Default | Description |
---|---|---|
String | String.Empty | A string value that is the pattern. |
Property Paths
You can access this nested property as listed below:
Object Type | Path to XCoordinatePattern |
---|---|
MapControl |
|
Remarks
To specify the pattern for the Geographical coordinate, use the following predefined values.
Pattern | Description |
---|---|
{CP} | Displays a cardinal point. |
{D:Number_of_decimal_places} | Displays a degree value. The number of decimal places can be unspecified. |
{M:Number_of_decimal_places} | Displays a minute value. The number of decimal places can be unspecified. |
{S:Number_of_decimal_places} | Displays a second value. The number of decimal places can be unspecified. |
To specify the pattern for the Cartesian coordinate, use the following predefined values.
Pattern | Description |
---|---|
{F:Number_of_decimal_places} | Displays a coordinate value. The number of decimal places can be unspecified. |
{MU} | Displays the abbreviation of measure unit name. |
Example
This example demonstrates how to change the text of map point coordinates displayed in the navigation panel using latitude and longitude format patterns.
To do this, specify a string that will represent the pattern displayed within a coordinate label in the map navigation panel using NavigationPanelOptions.XCoordinatePattern
and NavigationPanelOptions.YCoordinatePattern properties.
In this example, you can format the values of map point coordinates using a predefined list of patterns from the combo box. In the combo box, you can also specify a custom pattern using standard specifiers together with placeholders. For example: “{CP}{D}°{M}’{S:2}’’ “, where CP – is a cardinal point; D – is a degree; M - is a minute; S – is a second. Note that the precision specifier (“2”) indicates the desired number of decimal places.
using DevExpress.XtraEditors;
using System;
using System.Windows.Forms;
namespace MapCoordinatePatterns {
public partial class Form1 : Form {
string[] patterns = new string[] {
"{D:1}°{CP}",
"{CP}{D:6}°",
"{D}°{M:2}\'{CP}",
"{CP}{D}°{M:2}\'",
"{D}°{M}\'{S:4}\'\'{CP}",
"{CP}{D}°{M}\'{S:4}\'\'",
"Coordinates: {D}°{M}\'{S:2}\'\'{CP}"
};
public Form1() {
InitializeComponent();
PopulateComboBox(cbXCoordinatePattern);
PopulateComboBox(cbYCoordinatePattern);
}
private void PopulateComboBox(ComboBoxEdit comboBox) {
comboBox.Properties.Items.AddRange(patterns);
comboBox.EditValue = comboBox.Properties.Items[0];
}
private void OnXCoordinatePatternSelectedIndexChanged(object sender, EventArgs e) {
map.NavigationPanelOptions.XCoordinatePattern = cbXCoordinatePattern.EditValue as String;
}
private void OnYCoordinatePatternSelectedIndexChanged(object sender, EventArgs e) {
map.NavigationPanelOptions.YCoordinatePattern = cbYCoordinatePattern.EditValue as String;
}
}
}