Select to view content in your preferred language

Is there anyway to disable/enable Dockpane state and visibility functionality and events

166
1
a month ago
artifact
Occasional Contributor

Does anyone have an idea how to go about disabling and re-enabling the Dockpane visibility and state functions?

Basically, I'm trying to display an inspector view on a dockpane. However, if the user has the dockpane in autohide or hidden, then when my tool populates the inspector it isnt immediately obvious that anything has occurred to the user. 

No problem, when the inspector is loaded, ill store the current dockstate and visibility, then force dockpane activation and set the dock state to either docked mode or float (depending on which is most appropriate to the original state). In this way autohide doesnt close immediately if the user fails to click the dock on their next click, and I put everything right back how it was before when the inspector unloads from the dockpane.

Unfortunately, even in this state the user can still hide the dock as well as pin, unpin, etc. In hindsight I probably should have chose to used a modal dialog or similar for this purpose, but so much of ArcPro is docking based, I wanted to keep the workflows unified. I looked through all the DAML options, as well as the DockPane code, to try and find a place I could wrap or overload things like AvalonDock, but no luck. In a final desperate attempt I even tried to use the OnShow() event of the Dockpane to watch for these events, and attempt to delegate the opposite action back to the Dockpane... this of course failed catastrophically.

I dont know where to go from this point, if anyone has an idea how to accomplish this.. please chime in

0 Kudos
1 Reply
Wolf
by Esri Regular Contributor
Esri Regular Contributor

I am not sure if this will help you, but it seems to me that you can add code in your tool to deal with the hidden/visible state of your dockpane.  for example:

		protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
		{
			// in order to find a dockpane you need to know it's DAML id
			var pane = FrameworkApplication.DockPaneManager.Find("your_dockpane_id_here");

			// determine visibility
			bool visible = pane.IsVisible;
			MessageBox.Show($"Dockpane is {(visible ? "visible" : "not visible")}", "Dockpane Visibility");
			if (!visible) pane.Activate(true);
			return base.OnSketchCompleteAsync(geometry);
		}
0 Kudos