Class Graphic
A type of GeoElement that has a shape (geometry), symbol, and attributes and can be displayed in a map view or scene view.
Implements
Namespace: Esri.ArcGISRuntime.UI
Assembly: Esri.ArcGISRuntime.dll
Syntax
public class Graphic : GeoElement, INotifyPropertyChanged
Remarks
Graphics are used to represent temporary data that exists for the lifetime of the application. For example, you can:
- Show updated locations for objects in the map view, such as moving vehicles.
- Display results from an analysis, geocoding, or routing operation.
- Allow the user to draw temporary sketches on top of the map.
- Store user input, such as a set of route stops to visit.
- Show ad hoc text labels to describe things on the map.
To display a graphic, add it to a Graphics collection and add the graphics overlay to your map view or scene view.
Each graphic has a geometry describing its location and shape. To maximize performance, the geometry should have the same SpatialReference as the map view or scene view to which it is added. If the geometry has a different SpatialReference, it will be reprojected on-the-fly. This can be computationally expensive when displaying a large number of graphics.
A graphic can have an associated Symbol that defines the graphic's appearance. Alternatively, the GraphicsOverlay can be assigned a Renderer that determines the appearance of all graphics in the overlay. If a graphic has an associated symbol, the symbol will override the overlay's renderer for the graphic's display. The symbol used depends on the geometry type associated with the graphic. A MarkerSymbol is used for MapPoint and Multipoint geometries, a SimpleLineSymbol for Polyline geometries, and a SimpleFillSymbol for Polygon or Envelope geometries.
You can select or deselect graphics (IsSelected), change the visibility of a graphic (IsVisible), and manage the order in which they are displayed (ZIndex).
Each graphic can have a collection of attributes (as key-value pairs) to provide more information.
Constructors
Name | Description |
---|---|
Graphic() | Initializes a new instance of the Graphic class with a |
Graphic(Geometry) | Initializes a new instance of the Graphic class with the given geometry. |
Graphic(Geometry, Symbol) | Initializes a new instance of the Graphic class with the given geometry and symbol. |
Graphic(Geometry, IEnumerable<KeyValuePair<String, Object>>) | Initializes a new instance of the Graphic class with the given geometry and attributes. |
Graphic(Geometry, IEnumerable<KeyValuePair<String, Object>>, Symbol) | Initializes a new instance of the Graphic class with the given geometry, attributes, and symbol. |
Graphic(IEnumerable<KeyValuePair<String, Object>>) | Initializes a new instance of the Graphic class with the given attributes. |
Properties
Name | Description |
---|---|
Geometry | Gets or sets the Geometry of this graphic. |
GraphicsOverlay | Gets the GraphicsOverlay that this Graphic is attached to. |
IsSelected | Gets or sets a value indicating whether this graphic is selected. |
IsVisible | Gets or sets a value indicating whether this graphic is rendered on a map.
|
Symbol | Gets or sets the Symbol for this graphic. |
ZIndex | Gets or sets the draw order for graphics. Graphics with higher Z-index values are drawn on top of lower Z-index graphics. |
Name | Description |
---|---|
INotifyPropertyChanged.PropertyChanged | Occurs when a property value changes. |
Applies to
Target | Versions |
---|---|
.NET Standard 2.0 | 100.3 - 200.6 |
.NET | 100.13 - 200.6 |
.NET Windows | 100.13 - 200.6 |
.NET Android | 200.0 - 200.6 |
.NET iOS | 200.0 - 200.6 |
.NET Framework | 100.0 - 200.6 |
Xamarin.Android | 100.0 - 100.15 |
Xamarin.iOS | 100.0 - 100.15 |
UWP | 100.0 - 200.6 |