VisibilityMode Enum
Lists the values that specify visibility modes for various map elements.
Namespace: DevExpress.XtraMap
Assembly: DevExpress.XtraMap.v18.1.dll
Declaration
Members
Name | Description |
---|---|
Auto
|
Visibility is determined automatically. |
Visible
|
An element is visible. |
Hidden
|
An element is hidden. |
Related API Members
The following properties accept/return VisibilityMode values:
Remarks
Values listed by the VisibilityMode enumeration are used to set the MapLegendBase.Visibility, ShapeTitleOptions.Visibility and MapItemsLayerBase.ShapeTitlesVisibility properties.
Example
This example demonstrates how to change the appearance of a map dot title. To do this, you should specify the MapItemsLayerBase.ShapeTitlesPattern property.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-customize-the-appearance-of-a-map-shape-title-e5184
using DevExpress.Utils;
using DevExpress.XtraMap;
using System;
using System.Globalization;
using System.Windows.Forms;
using System.Xml.Linq;
namespace CustomizeShapeTitle {
public partial class Form1 : Form {
const string dataPath = @"..\..\capitals.xml";
public Form1() {
InitializeComponent();
InitializeMap();
}
private void InitializeMap() {
// Create a Map control and add it to the form.
MapControl map = new MapControl() {
Dock = DockStyle.Fill, CenterPoint = new GeoPoint(47, 2),
ZoomLevel = 4, ToolTipController = new ToolTipController()
};
this.Controls.Add(map);
// Create a layer to load image tiles.
ImageLayer tilesLayer = new ImageLayer() {
DataProvider = new OpenStreetMapDataProvider()
};
map.Layers.Add(tilesLayer);
// Create a layer to display shapes.
VectorItemsLayer itemsLayer = new VectorItemsLayer() {
// Provide data to generate shape items.
Data = LoadDataFromXML(dataPath),
// Enable shape titles.
ShapeTitlesVisibility = VisibilityMode.Visible,
// Each shape has a CityName attribute, which stores the capital name.
// To display this value as a shape title, let's specify the attribute name in braces.
ShapeTitlesPattern = "{CityName}",
// To display a Population attribute as a tooltip,
// let's specify the ToolTipPattern property as follows.
ToolTipPattern = "Population: {Population}"
};
map.Layers.Add(itemsLayer);
}
private MapItemStorage LoadDataFromXML(string filePath) {
MapItemStorage storage = new MapItemStorage();
// Load an XML document from the specified file path.
XDocument document = XDocument.Load(filePath);
if (document != null) {
foreach (XElement element in document.Element("Capitals").Elements()) {
// Specify shapes attributes by loaded from an XML file values.
double latitude = Convert.ToDouble(element.Element("Latitude").Value,
CultureInfo.InvariantCulture
);
double longitude = Convert.ToDouble(element.Element("Longitude").Value,
CultureInfo.InvariantCulture
);
string name = element.Element("Name").Value;
uint population = Convert.ToUInt32(element.Element("Population").Value);
MapDot capital = new MapDot() {
Location = new GeoPoint(latitude, longitude), Size = 20
};
capital.Attributes.Add(new MapItemAttribute()
{ Name = "CityName", Type = typeof(string), Value = name });
capital.Attributes.Add(new MapItemAttribute()
{ Name = "Population", Type = typeof(uint), Value = population });
storage.Items.Add(capital);
}
}
return storage;
}
}
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the VisibilityMode enum.
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.