private void bindOperationsLayerComboBox()
 {
     if (OperationalLayersComboBox != null)
     {
         if (LayersInMap != null)
         {
             List <LayerDisplay> layerDisplay = new List <LayerDisplay>();
             int i = 0;
             foreach (Layer layer in LayersInMap)
             {
                 GraphicsLayer graphicsLayer = layer as GraphicsLayer;
                 if (graphicsLayer != null)
                 {
                     layerDisplay.Add(new LayerDisplay()
                     {
                         Layer       = graphicsLayer,
                         DisplayName = graphicsLayer.GetValue(ESRI.ArcGIS.Client.Extensibility.MapApplication.LayerNameProperty) as string ??
                                       graphicsLayer.ID ?? "Layer " + i,
                     });
                 }
                 i++;
             }
             OperationalLayersComboBox.ItemsSource = layerDisplay;
         }
     }
 }
        void ToggleAllVisibilityButton_Click(object sender, RoutedEventArgs e)
        {
            GraphicsLayer graphicsLayer = Layer as GraphicsLayer;

            if (graphicsLayer == null)
            {
                return;
            }

            bool visible = !isClearAllState;
            Collection <FieldInfo> fields = graphicsLayer.GetValue(LayerExtensions.FieldsProperty) as Collection <FieldInfo>;

            if (fields == null)
            {
                return;
            }
            for (int i = 0; i < fields.Count; i++)
            {
                FieldInfo field = fields[i];
                field.VisibleInAttributeDisplay = visible;
            }

            isClearAllState = !isClearAllState;
            VisualStateManager.GoToState(this, isClearAllState ? "ClearAllState" : "SelectAllState", false);

            // For feature layers - add the name of the field to the OutFields collection
            FeatureLayer featureLayer = Layer as FeatureLayer;

            if (featureLayer == null)
            {
                return;
            }

            reBuildOutFields(featureLayer, fields);
        }
 public static GeometryType GetGeometryType(GraphicsLayer graphicsLayer)
 {
     if (graphicsLayer == null)
     {
         throw new ArgumentNullException("graphicsLayer");
     }
     return (GeometryType)graphicsLayer.GetValue(GeometryTypeProperty);
 }
Example #4
0
        void WebMapMapNotesPopups_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
        {
            GraphicsLayer glayer     = sender as GraphicsLayer;
            MapPoint      clickPoint = MyMap.ScreenToMap(e.GetPosition(MyMap));

            if (clickPoint != lastPoint)
            {
                if (glayer.GetValue(Document.PopupTemplateProperty) != null)
                {
                    DataTemplate dt = glayer.GetValue(Document.PopupTemplateProperty) as DataTemplate;

                    MyInfoWindow.Anchor          = clickPoint;
                    MyInfoWindow.ContentTemplate = dt;
                    MyInfoWindow.Content         = e.Graphic.Attributes;
                    MyInfoWindow.IsOpen          = true;
                    lastPoint = clickPoint;
                }
            }
        }
        private void bindToGraphicsLayer(GraphicsLayer graphicsLayer)
        {
            object fields = graphicsLayer.GetValue(LayerExtensions.FieldsProperty);

            if (fields is IEnumerable <FieldInfo> )
            {
                string displayField = LayerExtensions.GetDisplayField(graphicsLayer);
                if (string.IsNullOrEmpty(displayField))
                {
                    displayField = FieldInfo.GetDefaultDisplayField(fields as IEnumerable <FieldInfo>);
                    if (!string.IsNullOrEmpty(displayField))
                    {
                        LayerExtensions.SetDisplayField(graphicsLayer, displayField);
                    }
                }

                #region Set data context
                MapTipsConfigInfo info = new MapTipsConfigInfo()
                {
                    LayerSelectionVisibility = false,
                    PopUpsOnClick            = LayerExtensions.GetPopUpsOnClick(graphicsLayer),
                    IsPopupEnabled           = ESRI.ArcGIS.Client.Extensibility.LayerProperties.GetIsPopupEnabled(graphicsLayer),
                    Layer = graphicsLayer,
                };
                setFromWebMap(info);
                info.SupportsOnClick = true;
                info.Layers          = new Collection <LayerInformation>();

                LayerInformation item = new LayerInformation();
                item.PopUpsEnabled = true;
                item.ID            = 0;
                item.Name          = LayerExtensions.GetTitle(Layer);
                item.DisplayField  = displayField;
                item.Fields        = fields as Collection <FieldInfo>;
                if (graphicsLayer is FeatureLayer)
                {
                    foreach (FieldInfo field in item.Fields)
                    {
                        if (field.DomainSubtypeLookup == DomainSubtypeLookup.NotDefined)
                        {
                            field.DomainSubtypeLookup = FieldInfo.GetDomainSubTypeLookup(graphicsLayer, field);
                        }
                    }
                }
                info.Layers.Add(item);
                info.SelectedItem     = item;
                info.PropertyChanged += info_PropertyChanged;
                this.DataContext      = info;
                #endregion
            }
        }
        private void bindUIToLayer()
        {
            GraphicsLayer graphicsLayer = Layer as GraphicsLayer;

            if (graphicsLayer != null)
            {
                if (MapTipsDataGrid != null)
                {
                    MapTipsDataGrid.IsEnabled   = true;
                    MapTipsDataGrid.ItemsSource = graphicsLayer.GetValue(LayerExtensions.FieldsProperty) as IEnumerable <FieldInfo>;
                }
                if (ToggleAllVisibilityButton != null)
                {
                    ToggleAllVisibilityButton.IsEnabled = true;
                }
            }
            else
            {
                if (MapTipsDataGrid != null)
                {
                    MapTipsDataGrid.IsEnabled   = false;
                    MapTipsDataGrid.ItemsSource = null;
                }
                if (ToggleAllVisibilityButton != null)
                {
                    ToggleAllVisibilityButton.IsEnabled = false;
                }
            }

            if (graphicsLayer != null)
            {
                Collection <FieldInfo> fields = graphicsLayer.GetValue(LayerExtensions.FieldsProperty) as Collection <FieldInfo>;
                if (fields != null)
                {
                    CheckToggleButtonState(fields);
                }
            }
        }
        void buildAttributeNamesList(GraphicsLayer graphicsLayer, string rendererType)
        {
            if (graphicsLayer == null)
            {
                return;
            }

            Collection <FieldInfo> fields = graphicsLayer.GetValue(ESRI.ArcGIS.Mapping.Core.LayerExtensions.FieldsProperty) as Collection <FieldInfo>;

            if (fields != null)
            {
                if (rendererType == Constants.ClassBreaksRenderer)
                {
                    IEnumerable <FieldInfo> numericFields   = fields.Where <FieldInfo>(f => f.FieldType == FieldType.Integer || f.FieldType == FieldType.DecimalNumber || f.FieldType == FieldType.Currency);
                    FieldInfo           selectedField       = null;
                    ClassBreaksRenderer classBreaksRenderer = graphicsLayer.Renderer as ClassBreaksRenderer;
                    if (classBreaksRenderer != null)
                    {
                        foreach (FieldInfo fieldInfo in numericFields)
                        {
                            if (string.Compare(fieldInfo.Name, classBreaksRenderer.Field) == 0)
                            {
                                selectedField = fieldInfo;
                                break;
                            }
                        }
                    }
                    AttributeName.ItemsSource = numericFields;
                    if (null != selectedField)
                    {
                        _ignoreAttributeChangedEvent = true;
                        AttributeName.SelectedItem   = selectedField;
                        _ignoreAttributeChangedEvent = false;
                    }
                }
                else
                {
                    if (rendererType == Constants.UniqueValueRenderer)
                    {
                        FieldInfo selectedField = null;
                        IEnumerable <FieldInfo> allowedFields       = fields.Where <FieldInfo>(f => f.FieldType != FieldType.Attachment);
                        UniqueValueRenderer     uniqueValueRenderer = graphicsLayer.Renderer as UniqueValueRenderer;
                        if (uniqueValueRenderer != null)
                        {
                            foreach (FieldInfo fieldInfo in allowedFields)
                            {
                                if (string.Compare(fieldInfo.Name, uniqueValueRenderer.Field) == 0)
                                {
                                    selectedField = fieldInfo;
                                    break;
                                }
                            }
                        }
                        AttributeName.ItemsSource = allowedFields;
                        if (null != selectedField)
                        {
                            _ignoreAttributeChangedEvent = true;
                            AttributeName.SelectedItem   = selectedField;
                            _ignoreAttributeChangedEvent = false;
                        }
                    }
                    else
                    {
                        AttributeName.ItemsSource = null;
                    }
                }
            }
        }
        void buildAttributeNamesList(GraphicsLayer graphicsLayer, string rendererType)
        {
            if (graphicsLayer == null)
                return;

            Collection<FieldInfo> fields = graphicsLayer.GetValue(ESRI.ArcGIS.Mapping.Core.LayerExtensions.FieldsProperty) as Collection<FieldInfo>;
            if (fields != null)
            {
                if (rendererType == Constants.ClassBreaksRenderer)
                {
                    IEnumerable<FieldInfo> numericFields = fields.Where<FieldInfo>(f => f.FieldType == FieldType.Integer || f.FieldType == FieldType.DecimalNumber || f.FieldType == FieldType.Currency);
                    FieldInfo selectedField = null;
                    ClassBreaksRenderer classBreaksRenderer = graphicsLayer.Renderer as ClassBreaksRenderer;
                    if (classBreaksRenderer != null)
                    {
                        foreach (FieldInfo fieldInfo in numericFields)
                        {
                            if (string.Compare(fieldInfo.Name, classBreaksRenderer.Field) == 0)
                            {
                                selectedField = fieldInfo;
                                break;
                            }
                        }
                    }
                    AttributeName.ItemsSource = numericFields;
                    if (null != selectedField)
                    {
                        _ignoreAttributeChangedEvent = true;
                        AttributeName.SelectedItem = selectedField;
                        _ignoreAttributeChangedEvent = false;
                    }
                }
                else
                {
                    if (rendererType == Constants.UniqueValueRenderer)
                    {
                        FieldInfo selectedField = null;
                        IEnumerable<FieldInfo> allowedFields = fields.Where<FieldInfo>(f => f.FieldType != FieldType.Attachment);
                        UniqueValueRenderer uniqueValueRenderer = graphicsLayer.Renderer as UniqueValueRenderer;
                        if (uniqueValueRenderer != null)
                        {
                            foreach (FieldInfo fieldInfo in allowedFields)
                            {
                                if (string.Compare(fieldInfo.Name, uniqueValueRenderer.Field) == 0)
                                {
                                    selectedField = fieldInfo;
                                    break;
                                }
                            }
                        }
                        AttributeName.ItemsSource = allowedFields;
                        if (null != selectedField)
                        {
                            _ignoreAttributeChangedEvent = true;
                            AttributeName.SelectedItem = selectedField;
                            _ignoreAttributeChangedEvent = false;
                        }
                    }
                    else
                    {
                        AttributeName.ItemsSource = null;
                    }
                }
            }
        }
        private void bindToGraphicsLayer(GraphicsLayer graphicsLayer)
        {
            object fields = graphicsLayer.GetValue(LayerExtensions.FieldsProperty);

            if (fields is IEnumerable<FieldInfo>)
            {
                string displayField = LayerExtensions.GetDisplayField(graphicsLayer);
                if (string.IsNullOrEmpty(displayField))
                {
                    displayField = FieldInfo.GetDefaultDisplayField(fields as IEnumerable<FieldInfo>);
                    if (!string.IsNullOrEmpty(displayField))
                        LayerExtensions.SetDisplayField(graphicsLayer, displayField);
                }

                #region Set data context
                MapTipsConfigInfo info = new MapTipsConfigInfo()
                {
                    LayerSelectionVisibility = false,
                    PopUpsOnClick = LayerExtensions.GetPopUpsOnClick(graphicsLayer),
					IsPopupEnabled = ESRI.ArcGIS.Client.Extensibility.LayerProperties.GetIsPopupEnabled(graphicsLayer),
                    Layer = graphicsLayer,
                };
                setFromWebMap(info);
                    info.SupportsOnClick = true;
                info.Layers = new Collection<LayerInformation>();

                LayerInformation item = new LayerInformation();
                item.PopUpsEnabled = true;
                item.ID = 0;
                item.Name = LayerExtensions.GetTitle(Layer);
                item.DisplayField = displayField;
                item.Fields = fields as Collection<FieldInfo>;
				if (graphicsLayer is FeatureLayer)
				{
					foreach (FieldInfo field in item.Fields)
					{
						if (field.DomainSubtypeLookup == DomainSubtypeLookup.NotDefined)
							field.DomainSubtypeLookup = FieldInfo.GetDomainSubTypeLookup(graphicsLayer, field);
					}
				}
                info.Layers.Add(item);
                info.SelectedItem = item;
                info.PropertyChanged += info_PropertyChanged;
                this.DataContext = info;
                #endregion
            }
        }
Example #10
0
        protected void WriteGraphicsLayerElements(GraphicsLayer layer)
        {
            GeometryType geomType = (GeometryType)layer.GetValue(LayerExtensions.GeometryTypeProperty);

            if (geomType != default(GeometryType))
            {
                writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.GeometryType", Constants.esriMappingNamespace, geomType.ToString());
            }

            LinearGradientBrush defaultBrush = LayerExtensions.GetGradientBrush(layer);

            if (defaultBrush != null)
            {
                writer.WriteStartElement(Constants.esriMappingPrefix, "LayerExtensions.GradientBrush", Constants.esriMappingNamespace);
                BrushXamlWriter brushWriter = new BrushXamlWriter(writer, Namespaces);
                brushWriter.WriteBrush(defaultBrush);
                writer.WriteEndElement();
            }

            string rendererAttributeDisplayName = LayerExtensions.GetRendererAttributeDisplayName(layer);

            if (!string.IsNullOrEmpty(rendererAttributeDisplayName))
            {
                writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.RendererAttributeDisplayName", Constants.esriMappingNamespace, rendererAttributeDisplayName);
            }

            //string geomServiceUrl = layer.GetValue(LayerExtensions.GeometryServiceUrlProperty) as string;
            //if (!string.IsNullOrEmpty(geomServiceUrl))
            //{
            //    writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.GeometryServiceUrl", Constants.esriMappingNamespace, geomServiceUrl);
            //}

            //SpatialReference mapSpatialRef = (SpatialReference)layer.GetValue(LayerExtensions.MapSpatialReferenceProperty);
            //if (mapSpatialRef != null)
            //{
            //    writer.WriteStartElement(Constants.esriMappingPrefix, "LayerExtensions.MapSpatialReference", Constants.esriMappingNamespace);
            //    WriteSpatialReference(writer, Namespaces, mapSpatialRef);
            //    writer.WriteEndElement();
            //}

            //SpatialReference layerSpatialRef = (SpatialReference)layer.GetValue(LayerExtensions.LayerSpatialReferenceProperty);
            //if (layerSpatialRef != null)
            //{
            //    writer.WriteStartElement(Constants.esriMappingPrefix, "LayerExtensions.LayerSpatialReference", Constants.esriMappingNamespace);
            //    WriteSpatialReference(writer, Namespaces, layerSpatialRef);
            //    writer.WriteEndElement();
            //}

            Collection <FieldInfo> fields = (Collection <FieldInfo>)layer.GetValue(LayerExtensions.FieldsProperty);

            if (fields != null)
            {
                writer.WriteStartElement(Constants.esriMappingPrefix, "LayerExtensions.Fields", Constants.esriMappingNamespace);
                FieldInfo.WriteFieldInfos(fields, writer);
                writer.WriteEndElement();
            }
            string displayField = LayerExtensions.GetDisplayField(layer);

            if (!string.IsNullOrEmpty(displayField))
            {
                writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.DisplayField", Constants.esriMappingNamespace, displayField);
            }

            if (LayerExtensions.GetPopUpsOnClick(layer))
            {
                writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.PopUpsOnClick", Constants.esriMappingNamespace, "True");
            }
            else
            {
                writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.PopUpsOnClick", Constants.esriMappingNamespace, "False");
            }
            //string mapTipContainerXaml = layer.GetValue(LayerExtensions.MapTipContainerXamlProperty) as string;
            //if (!string.IsNullOrEmpty(mapTipContainerXaml))
            //{
            //    writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.MapTipContainerXaml", Constants.esriMappingNamespace, mapTipContainerXaml);

            //    writer.WriteStartElement("GraphicsLayer.MapTip", Constants.esriNamespace);

            //    writer.WriteStartElement("ContentControl");
            //    writer.WriteRaw(mapTipContainerXaml);
            //    writer.WriteEndElement();

            //    writer.WriteEndElement();
            //}

            if (layer.Clusterer != null)
            {
                WriteLayerClusterer(layer.Clusterer);
            }
            if (layer.Renderer != null)
            {
                WriteRenderer(layer.Renderer);
            }
            if (layer.Graphics.Count > 0)
            {
                WriteGraphicsDataset(layer);
            }

            //if (layer.MapTip != null)
            //{
            //writer.WriteStartElement("GraphicsLayer.MapTip", Namespaces[Constants.esriPrefix]);
            //if (LayerMapTipFormatting != null)
            //{
            //    LayerMapTipFormattingEventArgs args = new LayerMapTipFormattingEventArgs
            //    {
            //        Layer = layer
            //    };
            //    LayerMapTipFormatting(this, args);
            //    string mapTipXaml = args.LayerMapTipXaml;
            //    if (!string.IsNullOrEmpty(mapTipXaml))
            //    {
            //        writer.WriteRaw(mapTipXaml);
            //        //Write(MapTipXaml);
            //    }
            //    else
            //    {
            //        // Must write a content template.
            //        writer.WriteRaw("<ContentControl />");
            //    }
            //}

            //writer.WriteEndElement();
            //}
        }
 public static bool GetPopUpsOnClick(GraphicsLayer layer)
 {
     if (layer == null)
     {
         throw new ArgumentNullException("layer");
     }
     return (bool)layer.GetValue(PopUpsOnClickProperty);
 }
        protected void WriteGraphicsLayerElements(GraphicsLayer layer)
        {
            GeometryType geomType = (GeometryType)layer.GetValue(LayerExtensions.GeometryTypeProperty);
            if (geomType != default(GeometryType))
            {
                writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.GeometryType", Constants.esriMappingNamespace, geomType.ToString());
            }

            LinearGradientBrush defaultBrush = LayerExtensions.GetGradientBrush(layer);
            if (defaultBrush != null)
            {
                writer.WriteStartElement(Constants.esriMappingPrefix, "LayerExtensions.GradientBrush", Constants.esriMappingNamespace);
                BrushXamlWriter brushWriter = new BrushXamlWriter(writer, Namespaces);
                brushWriter.WriteBrush(defaultBrush);
                writer.WriteEndElement();
            }

            string rendererAttributeDisplayName = LayerExtensions.GetRendererAttributeDisplayName(layer);
            if (!string.IsNullOrEmpty(rendererAttributeDisplayName))
            {
                writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.RendererAttributeDisplayName", Constants.esriMappingNamespace, rendererAttributeDisplayName);
            }

            //string geomServiceUrl = layer.GetValue(LayerExtensions.GeometryServiceUrlProperty) as string;
            //if (!string.IsNullOrEmpty(geomServiceUrl))
            //{
            //    writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.GeometryServiceUrl", Constants.esriMappingNamespace, geomServiceUrl);
            //}   

            //SpatialReference mapSpatialRef = (SpatialReference)layer.GetValue(LayerExtensions.MapSpatialReferenceProperty);
            //if (mapSpatialRef != null)
            //{
            //    writer.WriteStartElement(Constants.esriMappingPrefix, "LayerExtensions.MapSpatialReference", Constants.esriMappingNamespace);
            //    WriteSpatialReference(writer, Namespaces, mapSpatialRef);
            //    writer.WriteEndElement();
            //}

            //SpatialReference layerSpatialRef = (SpatialReference)layer.GetValue(LayerExtensions.LayerSpatialReferenceProperty);
            //if (layerSpatialRef != null)
            //{
            //    writer.WriteStartElement(Constants.esriMappingPrefix, "LayerExtensions.LayerSpatialReference", Constants.esriMappingNamespace);
            //    WriteSpatialReference(writer, Namespaces, layerSpatialRef);
            //    writer.WriteEndElement();
            //}

            Collection<FieldInfo> fields = (Collection<FieldInfo>)layer.GetValue(LayerExtensions.FieldsProperty);
            if (fields != null)
            {
                writer.WriteStartElement(Constants.esriMappingPrefix, "LayerExtensions.Fields", Constants.esriMappingNamespace);
                FieldInfo.WriteFieldInfos(fields, writer);
                writer.WriteEndElement();
            }
            string displayField = LayerExtensions.GetDisplayField(layer);
            if (!string.IsNullOrEmpty(displayField))
            {
                writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.DisplayField", Constants.esriMappingNamespace, displayField);
            }

            if (LayerExtensions.GetPopUpsOnClick(layer))
                writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.PopUpsOnClick", Constants.esriMappingNamespace, "True");
            else
                writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.PopUpsOnClick", Constants.esriMappingNamespace, "False");
            //string mapTipContainerXaml = layer.GetValue(LayerExtensions.MapTipContainerXamlProperty) as string;
            //if (!string.IsNullOrEmpty(mapTipContainerXaml))
            //{
            //    writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.MapTipContainerXaml", Constants.esriMappingNamespace, mapTipContainerXaml);

            //    writer.WriteStartElement("GraphicsLayer.MapTip", Constants.esriNamespace);

            //    writer.WriteStartElement("ContentControl");
            //    writer.WriteRaw(mapTipContainerXaml);
            //    writer.WriteEndElement();

            //    writer.WriteEndElement();
            //}

            if (layer.Clusterer != null)
            {
                WriteLayerClusterer(layer.Clusterer);
            }
            if (layer.Renderer != null)
            {
                WriteRenderer(layer.Renderer);
            }
            if (layer.Graphics.Count > 0)
            {
                WriteGraphicsDataset(layer);
            }

            //if (layer.MapTip != null)
            //{                
            //writer.WriteStartElement("GraphicsLayer.MapTip", Namespaces[Constants.esriPrefix]);
            //if (LayerMapTipFormatting != null)
            //{
            //    LayerMapTipFormattingEventArgs args = new LayerMapTipFormattingEventArgs
            //    {
            //        Layer = layer
            //    };
            //    LayerMapTipFormatting(this, args);
            //    string mapTipXaml = args.LayerMapTipXaml;
            //    if (!string.IsNullOrEmpty(mapTipXaml))
            //    {
            //        writer.WriteRaw(mapTipXaml);
            //        //Write(MapTipXaml);
            //    }
            //    else
            //    {
            //        // Must write a content template.
            //        writer.WriteRaw("<ContentControl />");
            //    }
            //}

            //writer.WriteEndElement();
            //}
        }
        public static Collection<FieldInfo> GetFields(GraphicsLayer graphicsLayer)
        {
            if (graphicsLayer == null)
            {
                throw new ArgumentNullException("graphicsLayer");
            }

            Collection<FieldInfo> fields = graphicsLayer.GetValue(FieldsProperty) as Collection<FieldInfo>;
            if (fields == null)
            {
                // Initialize on demand
                fields = new Collection<FieldInfo>();
                SetFields(graphicsLayer, fields);
            }

            return fields;
        }
 public static bool GetIsMapTipDirty(GraphicsLayer graphicsLayer)
 {
     return (bool)graphicsLayer.GetValue(IsMapTipDirtyProperty);
 }
 public static string GetDisplayField(GraphicsLayer graphicsLayer)
 {
     return (string)graphicsLayer.GetValue(DisplayFieldProperty);
 }
 /// <summary>
 /// Gets the value of the Dataset attached property for a specified GraphicsLayer.
 /// </summary>
 /// <param name="layer">The GraphicsLayer from which the property value is read.</param>
 /// <returns>The Dataset property value for the GraphicsLayer.</returns>
 public static string GetDataset(GraphicsLayer layer)
 {
     if (layer == null)
     {
         throw new ArgumentNullException("element");
     }
     return layer.GetValue(DatasetProperty) as string;
 }
 /// <summary>
 /// Gets the value of the RendererAttributeDisplayName attached property for a specified GraphicsLayer.
 /// </summary>
 /// <param name="element">The GraphicsLayer from which the property value is read.</param>
 /// <returns>The RendererAttributeDisplayName property value for the GraphicsLayer.</returns>
 public static string GetRendererAttributeDisplayName(GraphicsLayer element)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     return element.GetValue(RendererAttributeDisplayNameProperty) as string;
 }
 /// <summary>
 /// Gets the value of the GradientBrush attached property for a specified GraphicsLayer.
 /// </summary>
 /// <param name="graphicsLayer">The GraphicsLayer from which the property value is read.</param>
 /// <returns>The GradientBrush property value for the GraphicsLayer.</returns>
 public static LinearGradientBrush GetGradientBrush(GraphicsLayer graphicsLayer)
 {
     if (graphicsLayer == null)
     {
         throw new ArgumentNullException("graphicsLayer");
     }
     return graphicsLayer.GetValue(GradientBrushProperty) as LinearGradientBrush;
 }