Using C#, I need to activate (or bring focus to) MapView.Active that has become inactive or been superseded. I need to ensure it's active before running operations on it in a customized interface. Thanks.
Hi Mike,
There is an example dealing with MapViews here: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/OpenMapViews
The code snippet below finds any map view pane with a given caption and brings the first matching one to the foreground (by calling .Activate()).
<SPAN class="keyword token">var</SPAN> mapPanes <SPAN class="operator token">=</SPAN> ProApp<SPAN class="punctuation token">.</SPAN>Panes<SPAN class="punctuation token">.</SPAN>OfType<SPAN class="operator token"><</SPAN>IMapPane<SPAN class="operator token">></SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">foreach</SPAN> <SPAN class="punctuation token">(</SPAN>Pane pane <SPAN class="keyword token">in</SPAN> mapPanes<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>pane<SPAN class="punctuation token">.</SPAN>Caption <SPAN class="operator token">==</SPAN> <SPAN class="string token">"Your map view's caption"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> pane<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Activate</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">break</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Thank You.
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.