<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Display point graphic from mouse click in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1071017#M10185</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/252052"&gt;@NathanCastle1&lt;/a&gt;&amp;nbsp;Thank you for those suggestions. Most of it is clear and makes sense as to why they would be better practice/necessary changes to be made.&lt;/P&gt;&lt;P&gt;Is there anything I need to do to call update to the view after creating this point? Or once I add it to the graphics overlay with&amp;nbsp; graphicsOverlay.Graphics.Add(pointGraphic); will it automatically update the view?&lt;/P&gt;&lt;P&gt;Another thing, I have the two classes MainWindow.xaml/MW.xaml.cs and MapViewModel.cs. MainWindow in it's constructor calls&amp;nbsp; InitializeComponent(); which in turns eventually calls the constructor of MapViewModel as part of setup. And then when I create an object of MapViewModel so that I can access the createPoint() method I call the constructor of MapViewModel again which will call setup() which just assigns the basemap type again. Would that mess this up?&lt;/P&gt;&lt;P&gt;I can include code snippets of this if needed.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Jun 2021 16:04:20 GMT</pubDate>
    <dc:creator>johnmarker</dc:creator>
    <dc:date>2021-06-22T16:04:20Z</dc:date>
    <item>
      <title>Display point graphic from mouse click</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1070741#M10181</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to be able to register a mouse click event and then plot a point graphic at that location. Right now I get the mouse click, get the location of that mouse click and then use those coordinates to create a graphic. After doing all this the point still does not display onto the map..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;//MainWindow.xaml.cs

        private void MainMapView_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            MapViewModel mvm = new MapViewModel();
            Point p = e.GetPosition(MainMapView);
            MapPoint mp = MainMapView.ScreenToLocation(e.GetPosition(MainMapView));
            mvm.createPoint(mp);
        }


//MapViewModel.cs

        public void createPoint(MapPoint point)
        {
            // Create a new graphics overlay to contain a variety of graphics.
            var graphicsOverlay = new GraphicsOverlay();

            // Add the overlay to a graphics overlay collection.
            GraphicsOverlayCollection overlays = new GraphicsOverlayCollection
            {
                graphicsOverlay
            };

            // Set the view model's "GraphicsOverlays" property (will be consumed by the map view).
            this.GraphicsOverlays = overlays;

            var mapPoint = new MapPoint(point.X, point.Y, SpatialReferences.Wgs84);

            // Create a symbol to define how the point is displayed.
            var pointSymbol = new SimpleMarkerSymbol
            {
                Style = SimpleMarkerSymbolStyle.X,
                Color = System.Drawing.Color.Red,
                Size = 10.0
            };

            // Add an outline to the symbol.
            pointSymbol.Outline = new SimpleLineSymbol
            {
                Style = SimpleLineSymbolStyle.Solid,
                Color = System.Drawing.Color.Red,
                Width = 2.0
            };

            // Create a point graphic with the geometry and symbol.
            var pointGraphic = new Graphic(mapPoint, pointSymbol);

            // Add the point graphic to graphics overlay.
            graphicsOverlay.Graphics.Add(pointGraphic);
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 21 Jun 2021 22:20:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1070741#M10181</guid>
      <dc:creator>johnmarker</dc:creator>
      <dc:date>2021-06-21T22:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Display point graphic from mouse click</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1070765#M10182</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It looks like there are a few problems in the code. If you are using the default basemaps, the map's spatial reference will be WebMercator. Currently, the code is creating a new point with WebMercator coordinates while having a WGS84 spatial reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var mapPoint = new MapPoint(point.X, point.Y, SpatialReferences.Wgs84);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;should change to&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var mapPoint = new MapPoint(point.X, point.Y, point.SpatialReference);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But note that this step shouldn't be necessary at all. You could reference `point` directly without creating `mapPoint`.&lt;/P&gt;&lt;P&gt;I also recommend a few other changes:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Consider using `GeoViewTapped` instead of `MouseLeftButtonUp`, as that will save you from needing to call `ScreenToLocation`&amp;nbsp;&lt;A href="https://developers.arcgis.com/net/wpf/api-reference/html/E_Esri_ArcGISRuntime_UI_Controls_GeoView_GeoViewTapped.htm" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/net/wpf/api-reference/html/E_Esri_ArcGISRuntime_UI_Controls_GeoView_GeoViewTapped.htm&lt;/A&gt;&amp;nbsp;GeoViewInputEventArgs has a Location property.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;You should be able to add an overlay to the overlay collection rather than re-creating the collection each time. You can also add multiple graphics to a single overlay. If you just want to be able to draw graphics on the map, you should only need to set up the overlay once at startup.&lt;/LI&gt;&lt;LI&gt;The ViewModel is being re-created every time the user clicks, and it isn't clear that the view is ever being re-configured to reference that ViewModel. The ViewModel would typically be created for the view only once. As written, I don't think you would ever see points, because a new ViewModel is created without the view being updated.&lt;/LI&gt;&lt;LI&gt;Creating the symbol for the graphics each time is perfectly valid code, but there is a simpler way. You can define a renderer on the overlay and any graphics you add will be drawn with the defined symbol. There is an example here:&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-runtime-samples-dotnet/tree/main/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/GraphicsOverlay/AddGraphicsRenderer" target="_blank" rel="noopener"&gt;https://github.com/Esri/arcgis-runtime-samples-dotnet/tree/main/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/GraphicsOverlay/AddGraphicsRenderer&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I hope that helps. Let me know if you have any other questions.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 22:55:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1070765#M10182</guid>
      <dc:creator>NathanCastle1</dc:creator>
      <dc:date>2021-06-21T22:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: Display point graphic from mouse click</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1071017#M10185</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/252052"&gt;@NathanCastle1&lt;/a&gt;&amp;nbsp;Thank you for those suggestions. Most of it is clear and makes sense as to why they would be better practice/necessary changes to be made.&lt;/P&gt;&lt;P&gt;Is there anything I need to do to call update to the view after creating this point? Or once I add it to the graphics overlay with&amp;nbsp; graphicsOverlay.Graphics.Add(pointGraphic); will it automatically update the view?&lt;/P&gt;&lt;P&gt;Another thing, I have the two classes MainWindow.xaml/MW.xaml.cs and MapViewModel.cs. MainWindow in it's constructor calls&amp;nbsp; InitializeComponent(); which in turns eventually calls the constructor of MapViewModel as part of setup. And then when I create an object of MapViewModel so that I can access the createPoint() method I call the constructor of MapViewModel again which will call setup() which just assigns the basemap type again. Would that mess this up?&lt;/P&gt;&lt;P&gt;I can include code snippets of this if needed.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 16:04:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1071017#M10185</guid>
      <dc:creator>johnmarker</dc:creator>
      <dc:date>2021-06-22T16:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Display point graphic from mouse click</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1071088#M10186</link>
      <description>&lt;P&gt;How are you setting the data context?&amp;nbsp; You should not need to have the code where you new up the ViewModel&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 17:33:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1071088#M10186</guid>
      <dc:creator>JoeHershman</dc:creator>
      <dc:date>2021-06-22T17:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: Display point graphic from mouse click</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1071097#M10188</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7529"&gt;@JoeHershman&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;//MainWindow.xaml.cs

    public partial class MainWindow : Window
    {
        private MapViewModel mvm;
        public MainWindow()
        {
            InitializeComponent();
            mvm = new MapViewModel();
            MapPoint mapCenterPoint = new MapPoint(-117.6709, 35.6225, SpatialReferences.Wgs84);
            MainMapView.SetViewpoint(new Viewpoint(mapCenterPoint, 100000));
        }

        private void MainMapView_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Point p = e.GetPosition(MainMapView);
            MapPoint mp = MainMapView.ScreenToLocation(e.GetPosition(MainMapView));
            mvm.createPoint(mp);
        }
    }


//MapViewModel.cs

    class MapViewModel : INotifyPropertyChanged
    {

        public MapViewModel()
        {
            SetupMap();
        }

        private void SetupMap()
        {
            // Create a new map with a 'topographic vector' basemap.
            Map = new Map(BasemapStyle.ArcGISTopographic);

        }&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 22 Jun 2021 17:52:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1071097#M10188</guid>
      <dc:creator>johnmarker</dc:creator>
      <dc:date>2021-06-22T17:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Display point graphic from mouse click</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1071159#M10189</link>
      <description>&lt;P&gt;When a graphic is added to a graphics overlay that is already in a mapview or sceneview, the graphic will be shown automatically, assuming there is a renderer or the graphic is configured with a symbol.&lt;/P&gt;&lt;P&gt;Based on the code you shared, it looks like you're following the pattern set in the template projects and the developer tutorials. If that is the case, you will see something like the following in your MainWindow.xaml file:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;Window.Resources&amp;gt;
    &amp;lt;local:MapViewModel x:Key="MapViewModel" /&amp;gt;
&amp;lt;/Window.Resources&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;That code will create an instance of your viewmodel when InitializeComponent is called.&lt;/P&gt;&lt;P&gt;The MapView's Map and GraphicsOverlays properties are set via binding:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;&amp;lt;esri:MapView x:Name="MainMapView"
              Map="{Binding Map, Source={StaticResource MapViewModel}}"
              GraphicsOverlays="{Binding GraphicsOverlays, Source={StaticResource MapViewModel}}" /&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;The view is bound to the specific instance of the viewmodel that is added to the `Window.Resources` dictionary. Your code is creating another instance of viewmodel, but that instance is never connected to the view in any way, so the view won't update to reflect changes in viewmodel state. You could fix this by re-setting up bindings when you create the viewmodel, or by using the existing viewmodel instance created in XAML.&lt;/P&gt;&lt;P&gt;I recommend updating your code to reference the copy of the ViewModel created in XAML:&lt;/P&gt;&lt;P&gt;You could use something like the following to get a reference to the viewmodel:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;mvm = FindResource("MapViewModel") as MapViewModel;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 19:22:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1071159#M10189</guid>
      <dc:creator>NathanCastle1</dc:creator>
      <dc:date>2021-06-22T19:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Display point graphic from mouse click</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1071161#M10190</link>
      <description>&lt;P&gt;What is in your Xaml?&amp;nbsp; Somewhere you must be setting the data context of the view.&amp;nbsp; This would be why it runs the constructor.&amp;nbsp; Are you using any MVVM libraries or just core WPF?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 19:23:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1071161#M10190</guid>
      <dc:creator>JoeHershman</dc:creator>
      <dc:date>2021-06-22T19:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Display point graphic from mouse click</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1071244#M10192</link>
      <description>&lt;P&gt;Assuming&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/252052"&gt;@NathanCastle1&lt;/a&gt;&amp;nbsp;is correct, which is what I also assume and why I asked about what is in the Xaml.&amp;nbsp; I'm going to go out on a limb and assume the DataContext is being set in the Xaml also.&amp;nbsp; However, without seeing the Xaml I cannot be sure exactly what is being done but I am going with this assumption.&lt;/P&gt;&lt;P&gt;One nice MVVM approach to adding functionality, imo, is using TriggerActions.&amp;nbsp; Especially if you are not using an external library to handle Commanding and Eventing&lt;/P&gt;&lt;P&gt;Based on the code you have above we could create an Action that handles the GeoViewTapped and then creates the point.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;public class CreatePointAction : TriggerAction&amp;lt;MapView&amp;gt;
{
	private static bool _doubleTapped;

	protected override void OnAttached()
	{
		base.OnAttached();
		if (!(AssociatedObject is MapView mapView)) return;

		//This seems silly to me, but a GeoViewDoubleTapped fires both a tapped and a double tapped.
		//This indicate was double tapped
		mapView.GeoViewDoubleTapped += (s, e) =&amp;gt; { _doubleTapped = true; };
	}


	protected override async void Invoke(object parameter)
	{
		await Task.Delay(250);
		if (_doubleTapped)
		{
			_doubleTapped = false;
			return;
		}

		if (!(AssociatedObject is MapView mapView)) return;
		if (!(parameter is GeoViewInputEventArgs args)) return;

		//I'm just going to assume only the one layer
		var graphicsOverlay = mapView.GraphicsOverlays.FirstOrDefault();
		if ( graphicsOverlay == null ) return;

		AddPoint(graphicsOverlay, args.Location);
	}

	private void AddPoint(GraphicsOverlay graphicsOverlay, MapPoint mapPoint)
	{
		var pointSymbol = new SimpleMarkerSymbol
		{
			Style = SimpleMarkerSymbolStyle.X,
			Color = System.Drawing.Color.Red,
			Size = 10.0,
			Outline = new SimpleLineSymbol
			{
				Style = SimpleLineSymbolStyle.Solid, Color = System.Drawing.Color.Red, Width = 2.0
			}
		};

		// Create a point graphic with the geometry and symbol.
		var pointGraphic = new Graphic(mapPoint, pointSymbol);

		// Add the point graphic to graphics overlay.
		graphicsOverlay.Graphics.Add(pointGraphic);
	}
}&lt;/LI-CODE&gt;&lt;P&gt;To wire this in we add the Action as an EventTrigger in our MapView definition&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;esri:MapView x:Name="MapView" Map="{Binding Map}" GraphicsOverlays="{Binding GraphicsOverlays}"&amp;gt;
	&amp;lt;i:Interaction.Triggers&amp;gt;
		&amp;lt;i:EventTrigger EventName="GeoViewTapped"&amp;gt;
			&amp;lt;local:CreatePointAction&amp;gt;&amp;lt;/local:CreatePointAction&amp;gt;
		&amp;lt;/i:EventTrigger&amp;gt;
	&amp;lt;/i:Interaction.Triggers&amp;gt;
&amp;lt;/esri:MapView&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Similar to what you are already doing you can setup the view point in the View constructor.&amp;nbsp; But we do not need to instantiate the VM, this was done and we are not using the VM in any code in the code behind&lt;/P&gt;&lt;LI-CODE lang="c"&gt;public partial class MainWindow : Window
{
	public MainWindow()
	{
		InitializeComponent();
		MapPoint mapCenterPoint = new MapPoint(-117.6709, 35.6225, SpatialReferences.Wgs84);
		MainMapView.SetViewpoint(new Viewpoint(mapCenterPoint, 100000));
	}
}&lt;/LI-CODE&gt;&lt;P&gt;And in the ViewModel the map initialization can be done as before&lt;/P&gt;&lt;LI-CODE lang="c"&gt;public class MapViewModel
{
	protected GraphicsOverlay EditGraphicsOverlay { get; } = new GraphicsOverlay { Id = nameof(EditGraphicsOverlay) };
	
	public MapViewModel()
	{
		 SetupMap();
		 AddGraphicsOverlays();
	}
	
	private void SetupMap()
	{
		// Create a new map with a 'topographic vector' basemap.
		Map = new Map(BasemapStyle.ArcGISTopographic);
	}
	
	private void AddGraphicsOverlays()
	{
		if (!GraphicsOverlays.Contains(EditGraphicsOverlay))
		{
			GraphicsOverlays.Add(EditGraphicsOverlay);
		}
	}
}&lt;/LI-CODE&gt;&lt;P&gt;With that we should have everything wired up.&amp;nbsp; There is no functional code in code behind all logic is in the Action and ViewModel.&amp;nbsp; The Action could be reused in another project without need to change anything, just include the definition in the MapView xaml&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 21:53:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1071244#M10192</guid>
      <dc:creator>JoeHershman</dc:creator>
      <dc:date>2021-06-22T21:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Display point graphic from mouse click</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1071269#M10193</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/252052"&gt;@NathanCastle1&lt;/a&gt;&amp;nbsp;Thank you for your explanation. It was very clear and helpful. I was following the template project while trying to look things up that it did not explain (the&amp;nbsp;&lt;SPAN&gt;InitializeComponent&amp;nbsp;method being one of those things).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 22:31:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1071269#M10193</guid>
      <dc:creator>johnmarker</dc:creator>
      <dc:date>2021-06-22T22:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: Display point graphic from mouse click</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1072313#M10213</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7529"&gt;@JoeHershman&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is what my MainWindow.xaml looks like.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;&amp;lt;Window x:Class="map_display.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:map_display"
        xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800"&amp;gt;
    &amp;lt;Window.Resources&amp;gt;
        &amp;lt;local:MapViewModel x:Key="MapViewModel" /&amp;gt;
    &amp;lt;/Window.Resources&amp;gt;
    &amp;lt;Grid&amp;gt;
        &amp;lt;esri:MapView x:Name="MainMapView"
                      Map="{Binding Map, Source={StaticResource MapViewModel}}" 
                      GraphicsOverlays="{Binding GraphicsOverlays, Source={StaticResource MapViewModel}}" 
                      MouseLeftButtonUp ="MainMapView_MouseLeftButtonUp" /&amp;gt;

    &amp;lt;/Grid&amp;gt;
&amp;lt;/Window&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 20:54:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1072313#M10213</guid>
      <dc:creator>johnmarker</dc:creator>
      <dc:date>2021-06-24T20:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Display point graphic from mouse click</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1168624#M10929</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/98853"&gt;@johnmarker&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to be able to register a mouse click event and then plot a point graphic at that location. Right now I get the mouse click on the &lt;A href="https://www.clickspeedtester.com/click-counter/" target="_self"&gt;click counter&lt;/A&gt;, get the location of that mouse click and then use those coordinates to create a graphic. After doing all this the point still does not display onto the map..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;//MainWindow.xaml.cs

        private void MainMapView_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            MapViewModel mvm = new MapViewModel();
            Point p = e.GetPosition(MainMapView);
            MapPoint mp = MainMapView.ScreenToLocation(e.GetPosition(MainMapView));
            mvm.createPoint(mp);
        }


//MapViewModel.cs

        public void createPoint(MapPoint point)
        {
            // Create a new graphics overlay to contain a variety of graphics.
            var graphicsOverlay = new GraphicsOverlay();

            // Add the overlay to a graphics overlay collection.
            GraphicsOverlayCollection overlays = new GraphicsOverlayCollection
            {
                graphicsOverlay
            };

            // Set the view model's "GraphicsOverlays" property (will be consumed by the map view).
            this.GraphicsOverlays = overlays;

            var mapPoint = new MapPoint(point.X, point.Y, SpatialReferences.Wgs84);

            // Create a symbol to define how the point is displayed.
            var pointSymbol = new SimpleMarkerSymbol
            {
                Style = SimpleMarkerSymbolStyle.X,
                Color = System.Drawing.Color.Red,
                Size = 10.0
            };

            // Add an outline to the symbol.
            pointSymbol.Outline = new SimpleLineSymbol
            {
                Style = SimpleLineSymbolStyle.Solid,
                Color = System.Drawing.Color.Red,
                Width = 2.0
            };

            // Create a point graphic with the geometry and symbol.
            var pointGraphic = new Graphic(mapPoint, pointSymbol);

            // Add the point graphic to graphics overlay.
            graphicsOverlay.Graphics.Add(pointGraphic);
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;This code is creating the graphic just for a millisecond.. it disappears as soon as it is plotted. I think that's something to be fixed.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 04:36:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1168624#M10929</guid>
      <dc:creator>MattNicholas</dc:creator>
      <dc:date>2022-04-28T04:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: Display point graphic from mouse click</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1294903#M11877</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi there! I've encountered a similar issue before while working on a click event functionality. Have you considered checking the visibility settings or layer configurations of your map graphic? Sometimes, the point might be getting created but isn't visible due to styling or layer options. Additionally, double-checking the projection system or coordinate system compatibility between the mouse click coordinates and the map graphic can also be helpful. Feel free to provide more details, and we can further explore possible solutions. Good luck with your &lt;A href="https://clicktester.net/1-second-cps-test/" target="_self"&gt;1 Second CPS test&lt;/A&gt; implementation!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 05:59:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/display-point-graphic-from-mouse-click/m-p/1294903#M11877</guid>
      <dc:creator>ElsaSmith</dc:creator>
      <dc:date>2023-06-02T05:59:27Z</dc:date>
    </item>
  </channel>
</rss>

