Show / Hide Table of Contents

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.

Inheritance
System.Object
GeoElement
Graphic
Implements
System.ComponentModel.INotifyPropertyChanged
GeoElement.Attributes
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
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 null geometry and symbol..

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. true if the graphic is visible, false otherwise.

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

TargetVersions
.NET Standard 2.0100.3 - 200.7
.NET100.13 - 200.7
.NET Windows100.13 - 200.7
.NET Android200.0 - 200.7
.NET iOS200.0 - 200.7
.NET Framework100.0 - 200.7
Xamarin.Android100.0 - 100.15
Xamarin.iOS100.0 - 100.15
UWP100.0 - 200.7

Relevant samples

Add graphics with symbols: Use a symbol style to display a graphic on a graphics overlay.
Buffer: Create a buffer around a map point and display the results as a `Graphic`
In This Article
Back to top Copyright © 2022 Esri.