I used overview in SDK sample code and wanna add graphic on it. The graphic does not show unless I added a messagebox and show it ( the red text below). Can anyone has solution of it?
var extent = MapView.Active.Extent;
var height = extent.Height;
var width = extent.Width;
var centerPt = extent.Center;
Hi,
Your _overview.MyMapControl.OverlayControl equal null. This is the reason why you can add overlay. Create new OverlayControl, set it to _overview.MyMapControl. Then try to add overlay.
How to deal with OverlayControl look at the community sample ScribbleControl_ArcGISPro
I checked it is not null. It is a popup WPF windows, the added overlay symbol only can show after I added a MessageBox.show message and pop up first.
Hi,
I have debugged on ArcGIS Pro 3.1 and found, _overview.MyMapControl.OverlayControl before adding overlay is equal null.
Another one thing you need to make your OnClick() method async and add await before calling QueuedTask.Run. Without await it returns Task type object
is it possible to add a polygon symbol inside the overview WPF window without adding current active view?
Hello,
You need to wait until the MapControl on the overview window has finished drawing before you can add anything to it's overlay. Move your code into an event handler for the DrawComplete.
Your OnClick method should look like the following
protected override void OnClick()
{
if (_isOpen)
return;
_overview = new OverviewWindow();
var cam = MapView.Active.Camera;
//cam.Heading = 90;
_overview.ViewContent = MapControlContentFactory.Create(MapView.Active.Map, cam, MapView.Active.ViewingMode);
_overview.Closed += (s, e) =>
{
_isOpen = false;
lock (_lock)
{
_overview = null;
}
};
_overview.MyMapControl.DrawComplete += (s, e) =>
{
if (MapView.Active == null)
return;
var extent = MapView.Active.Extent;
var height = extent.Height;
var width = extent.Width;
var centerPt = extent.Center;
QueuedTask.Run(() =>
{
_overview.MyMapControl.AddOverlay(centerPt,
SymbolFactory.Instance.ConstructPointSymbol(
ColorFactory.Instance.RedRGB, 30.0, SimpleMarkerStyle.Star).MakeSymbolReference());
});
};
_overview.Show();
_isOpen = true;
}
Narelle