<?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: Update Visibility of Controls in Dockpane in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/update-visibility-of-controls-in-dockpane/m-p/769002#M539</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abel,&lt;/P&gt;&lt;P&gt;&amp;nbsp;Since this seems to be a common question, let me elaborate a bit.&amp;nbsp; Maybe this will also help others looking at this post.&amp;nbsp;&amp;nbsp;MVVM is an architectural programming pattern that is used in most WPF based large scale or enterprise systems.&amp;nbsp; I think in the long run a good understanding on what it does will make programming using MVVM a lot easier.&amp;nbsp; I used WinForms for many years (if not decades) and it took me a while to get used to MVVM but after I got my head around it, I actually prefer it now.&amp;nbsp; If you have some time maybe you can look at this YouTube:&amp;nbsp;&amp;nbsp;&lt;A href="https://www.bing.com/videos/search?q=c%23+wpf+mvvm+intro&amp;amp;&amp;amp;view=detail&amp;amp;mid=A657BB347489ED159701A657BB347489ED159701&amp;amp;&amp;amp;FORM=VRDGAR&amp;amp;ru=%2Fvideos%2Fsearch%3Fq%3Dc%2523%2520wpf%2520mvvm%2520intro%26qs%3Dn%26form%3DQBVDMH%26sp%3D-1%26pq%3Dc%2523%2520wpf%2520mvvm%2520intro%26sc%3D1-17%26sk%3D%26cvid%3D87268C575B414F2DB80AB7D58CAA2F9C" rel="nofollow noopener noreferrer" target="_blank"&gt;WPF: why MVVM?&lt;/A&gt;&amp;nbsp;The video explains the "why?", but also looks a bit behind the curtain of MVVM.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Specifically to answer your question: controlling the visibility of controls on your dockpane:&lt;/P&gt;&lt;P&gt;&amp;nbsp;Since you already know that you need to bind the Visibility attribute of your UI control,&amp;nbsp;I want to mention the approach that I often use when looking for a reference sample implementation:&lt;/P&gt;&lt;P&gt;On the top left of the &lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples" rel="nofollow noopener noreferrer" target="_blank"&gt;community samples&amp;nbsp;github repo&lt;/A&gt;&amp;nbsp;page&amp;nbsp;I enter the text string for which&amp;nbsp;I need a code snippet for (as specific as possible to reduce the number of candidates).&amp;nbsp; So for your requirements I searched for 'Visibility="{Binding' (note: only search for this repo not all of Github):&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/490641_pastedImage_4.png" /&gt;&lt;/P&gt;&lt;P&gt;In similar fashion you can also search&amp;nbsp;&lt;A class="jivelink11" href="https://github.com/Esri/arcgis-pro-sdk" title="https://github.com/Esri/arcgis-pro-sdk" rel="nofollow noopener noreferrer" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk&lt;/A&gt;&amp;nbsp;because it contains the source for all ProSnippets.&amp;nbsp; The search above yields&amp;nbsp;all controls that are bound to some kind of 'visibility' property in my viewmodel.&amp;nbsp; I open the "Samples" solution (from community samples) in Visual Studio and look at the located solutions there.&amp;nbsp; In this case I search in Visual Studio for '&lt;EM&gt;&amp;lt;Grid Visibility="{Binding DockpaneVisibility}"&amp;gt;&lt;/EM&gt;' which yields the 'SymbolLookup' project.&amp;nbsp; I open the ViewModel file:&amp;nbsp;SymbolLookupDockpaneViewModel.cs and the View file:&amp;nbsp;SymbolLookupDockpane.xaml.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Databinding links the&amp;nbsp;'DockpaneVisibility' property:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;private&lt;/SPAN&gt; Visibility _dockpaneVisibility&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;/// &amp;lt;summary&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;/// Controls the visible state of the controls on the dockpane&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;/// &amp;lt;/summary&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;public&lt;/SPAN&gt; Visibility DockpaneVisibility
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;get&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; _dockpaneVisibility&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;set&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;SetProperty&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;ref&lt;/SPAN&gt; _dockpaneVisibility&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;value&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; DockpaneVisibility&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;To this UI element:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="punctuation token"&gt;&amp;lt;&lt;/SPAN&gt;Grid&lt;/SPAN&gt; &lt;SPAN class="attr-name token"&gt;Visibility&lt;/SPAN&gt;&lt;SPAN class="attr-value token"&gt;&lt;SPAN class="punctuation token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;{Binding DockpaneVisibility}&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Note that 'SetProperty(ref...' the&amp;nbsp;DockpaneVisibility setter is required because this method will 'notify' the UI (via data binding) when the code changes the&amp;nbsp;DockpaneVisibility property.&lt;/P&gt;&lt;P&gt;To change your control's visibility you can use the following code snippets:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;// make the control bound to DockpaneVisibility invisible:&lt;/SPAN&gt;
DockpaneVisibility &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Visibility&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Collapsed&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// make the control bound to DockpaneVisibility visible:&lt;/SPAN&gt;
DockpaneVisibility &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Visibility&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Visible&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Finally, and you see the code for this also in the&amp;nbsp;&lt;SPAN&gt;ViewModel file:&amp;nbsp;SymbolLookupDockpaneViewModel.cs: you can subscribe to the ActiveMapViewChangedEvent either in the constructor on in InitializeAsync:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;protected&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;SymbolLookupDockpaneViewModel&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;//either Subscribe to ActiveMapViewChangedEvent here:&lt;/SPAN&gt;
  ActiveMapViewChangedEvent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Subscribe&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;OnActiveMapViewChangedEvent&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;protected&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;override&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;async&lt;/SPAN&gt; Task &lt;SPAN class="token function"&gt;InitializeAsync&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;//or Subscribe to ActiveMapViewChangedEvent here:&lt;/SPAN&gt;
  ActiveMapViewChangedEvent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Subscribe&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;OnActiveMapViewChangedEvent&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And your subscription logic could look like this (similar to the sample I found):&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;/// &amp;lt;summary&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;/// Event handler when the active MapView changes&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;/// &amp;lt;/summary&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;/// &amp;lt;param name="obj"&amp;gt;&amp;lt;/param&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;private&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;OnActiveMapViewChangedEvent&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ActiveMapViewChangedEventArgs obj&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;obj&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;IncomingView &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;// there is no active map view - disable the UI&lt;/SPAN&gt;
    DockpaneVisibility &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Visibility&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Collapsed&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;// we have an active map view - enable the UI&lt;/SPAN&gt;
  DockpaneVisibility &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Visibility&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Visible&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Since this code will only kick in after your dockpane is instantiated (it's constructor is called), you need to set up the initial visibility state in the constructor:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;protected&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;SymbolLookupDockpaneViewModel&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;//setup the initial visibility state&lt;/SPAN&gt;
  DockpaneVisibility &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; MapView&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Active &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;?&lt;/SPAN&gt; Visibility&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Visible &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; Visibility&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Collapsed&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;//either Subscribe to ActiveMapViewChangedEvent here:&lt;/SPAN&gt;
  ActiveMapViewChangedEvent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Subscribe&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;OnActiveMapViewChangedEvent&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 08:34:17 GMT</pubDate>
    <dc:creator>Wolf</dc:creator>
    <dc:date>2021-12-12T08:34:17Z</dc:date>
    <item>
      <title>Update Visibility of Controls in Dockpane</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/update-visibility-of-controls-in-dockpane/m-p/769001#M538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a DockPane with several controls and I need to change the visibility based on the active Map&lt;/P&gt;&lt;P&gt;For example I have a button "Import From Map". If there is no active view that is a map then I want to hide these controls, otherwise i want to display the controls.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I looked at the community samples.&amp;nbsp;ProceduralSymbolLayersWithRulePackages and ProceduralSymbolLayersWithRulePackages. Ive also watched the ESRI video on MVVM&amp;nbsp;&lt;A class="link-titled" href="https://www.youtube.com/watch?v=5PgaeZycWXc" title="https://www.youtube.com/watch?v=5PgaeZycWXc"&gt;ArcGIS Pro SDK for .NET: UI Design and MVVM - YouTube&lt;/A&gt;&amp;nbsp;&amp;nbsp;and searched on geonet. I'm still not getting it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know I have to setup my control XAML with the binding Visibility="{Binding ControlVisible}" and then that property has to be developed. How do i subscribe to the Pro events so that it will tell my property that the active view has changed and thus the controls need updating? I just cant seem to connect the dots.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 May 2020 18:37:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/update-visibility-of-controls-in-dockpane/m-p/769001#M538</guid>
      <dc:creator>AbelPerez</dc:creator>
      <dc:date>2020-05-01T18:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: Update Visibility of Controls in Dockpane</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/update-visibility-of-controls-in-dockpane/m-p/769002#M539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abel,&lt;/P&gt;&lt;P&gt;&amp;nbsp;Since this seems to be a common question, let me elaborate a bit.&amp;nbsp; Maybe this will also help others looking at this post.&amp;nbsp;&amp;nbsp;MVVM is an architectural programming pattern that is used in most WPF based large scale or enterprise systems.&amp;nbsp; I think in the long run a good understanding on what it does will make programming using MVVM a lot easier.&amp;nbsp; I used WinForms for many years (if not decades) and it took me a while to get used to MVVM but after I got my head around it, I actually prefer it now.&amp;nbsp; If you have some time maybe you can look at this YouTube:&amp;nbsp;&amp;nbsp;&lt;A href="https://www.bing.com/videos/search?q=c%23+wpf+mvvm+intro&amp;amp;&amp;amp;view=detail&amp;amp;mid=A657BB347489ED159701A657BB347489ED159701&amp;amp;&amp;amp;FORM=VRDGAR&amp;amp;ru=%2Fvideos%2Fsearch%3Fq%3Dc%2523%2520wpf%2520mvvm%2520intro%26qs%3Dn%26form%3DQBVDMH%26sp%3D-1%26pq%3Dc%2523%2520wpf%2520mvvm%2520intro%26sc%3D1-17%26sk%3D%26cvid%3D87268C575B414F2DB80AB7D58CAA2F9C" rel="nofollow noopener noreferrer" target="_blank"&gt;WPF: why MVVM?&lt;/A&gt;&amp;nbsp;The video explains the "why?", but also looks a bit behind the curtain of MVVM.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Specifically to answer your question: controlling the visibility of controls on your dockpane:&lt;/P&gt;&lt;P&gt;&amp;nbsp;Since you already know that you need to bind the Visibility attribute of your UI control,&amp;nbsp;I want to mention the approach that I often use when looking for a reference sample implementation:&lt;/P&gt;&lt;P&gt;On the top left of the &lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples" rel="nofollow noopener noreferrer" target="_blank"&gt;community samples&amp;nbsp;github repo&lt;/A&gt;&amp;nbsp;page&amp;nbsp;I enter the text string for which&amp;nbsp;I need a code snippet for (as specific as possible to reduce the number of candidates).&amp;nbsp; So for your requirements I searched for 'Visibility="{Binding' (note: only search for this repo not all of Github):&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/490641_pastedImage_4.png" /&gt;&lt;/P&gt;&lt;P&gt;In similar fashion you can also search&amp;nbsp;&lt;A class="jivelink11" href="https://github.com/Esri/arcgis-pro-sdk" title="https://github.com/Esri/arcgis-pro-sdk" rel="nofollow noopener noreferrer" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk&lt;/A&gt;&amp;nbsp;because it contains the source for all ProSnippets.&amp;nbsp; The search above yields&amp;nbsp;all controls that are bound to some kind of 'visibility' property in my viewmodel.&amp;nbsp; I open the "Samples" solution (from community samples) in Visual Studio and look at the located solutions there.&amp;nbsp; In this case I search in Visual Studio for '&lt;EM&gt;&amp;lt;Grid Visibility="{Binding DockpaneVisibility}"&amp;gt;&lt;/EM&gt;' which yields the 'SymbolLookup' project.&amp;nbsp; I open the ViewModel file:&amp;nbsp;SymbolLookupDockpaneViewModel.cs and the View file:&amp;nbsp;SymbolLookupDockpane.xaml.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Databinding links the&amp;nbsp;'DockpaneVisibility' property:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;private&lt;/SPAN&gt; Visibility _dockpaneVisibility&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;/// &amp;lt;summary&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;/// Controls the visible state of the controls on the dockpane&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;/// &amp;lt;/summary&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;public&lt;/SPAN&gt; Visibility DockpaneVisibility
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;get&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; _dockpaneVisibility&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;set&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;SetProperty&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;ref&lt;/SPAN&gt; _dockpaneVisibility&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;value&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; DockpaneVisibility&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;To this UI element:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="punctuation token"&gt;&amp;lt;&lt;/SPAN&gt;Grid&lt;/SPAN&gt; &lt;SPAN class="attr-name token"&gt;Visibility&lt;/SPAN&gt;&lt;SPAN class="attr-value token"&gt;&lt;SPAN class="punctuation token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;{Binding DockpaneVisibility}&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Note that 'SetProperty(ref...' the&amp;nbsp;DockpaneVisibility setter is required because this method will 'notify' the UI (via data binding) when the code changes the&amp;nbsp;DockpaneVisibility property.&lt;/P&gt;&lt;P&gt;To change your control's visibility you can use the following code snippets:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;// make the control bound to DockpaneVisibility invisible:&lt;/SPAN&gt;
DockpaneVisibility &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Visibility&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Collapsed&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// make the control bound to DockpaneVisibility visible:&lt;/SPAN&gt;
DockpaneVisibility &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Visibility&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Visible&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Finally, and you see the code for this also in the&amp;nbsp;&lt;SPAN&gt;ViewModel file:&amp;nbsp;SymbolLookupDockpaneViewModel.cs: you can subscribe to the ActiveMapViewChangedEvent either in the constructor on in InitializeAsync:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;protected&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;SymbolLookupDockpaneViewModel&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;//either Subscribe to ActiveMapViewChangedEvent here:&lt;/SPAN&gt;
  ActiveMapViewChangedEvent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Subscribe&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;OnActiveMapViewChangedEvent&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;protected&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;override&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;async&lt;/SPAN&gt; Task &lt;SPAN class="token function"&gt;InitializeAsync&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;//or Subscribe to ActiveMapViewChangedEvent here:&lt;/SPAN&gt;
  ActiveMapViewChangedEvent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Subscribe&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;OnActiveMapViewChangedEvent&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And your subscription logic could look like this (similar to the sample I found):&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;/// &amp;lt;summary&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;/// Event handler when the active MapView changes&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;/// &amp;lt;/summary&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;/// &amp;lt;param name="obj"&amp;gt;&amp;lt;/param&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;private&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;OnActiveMapViewChangedEvent&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ActiveMapViewChangedEventArgs obj&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;obj&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;IncomingView &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;// there is no active map view - disable the UI&lt;/SPAN&gt;
    DockpaneVisibility &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Visibility&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Collapsed&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;// we have an active map view - enable the UI&lt;/SPAN&gt;
  DockpaneVisibility &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Visibility&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Visible&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Since this code will only kick in after your dockpane is instantiated (it's constructor is called), you need to set up the initial visibility state in the constructor:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;protected&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;SymbolLookupDockpaneViewModel&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;//setup the initial visibility state&lt;/SPAN&gt;
  DockpaneVisibility &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; MapView&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Active &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;?&lt;/SPAN&gt; Visibility&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Visible &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; Visibility&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Collapsed&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;//either Subscribe to ActiveMapViewChangedEvent here:&lt;/SPAN&gt;
  ActiveMapViewChangedEvent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Subscribe&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;OnActiveMapViewChangedEvent&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:34:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/update-visibility-of-controls-in-dockpane/m-p/769002#M539</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-12-12T08:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Update Visibility of Controls in Dockpane</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/update-visibility-of-controls-in-dockpane/m-p/769003#M540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wow just one brief look at this and i already understand it. Let me take the path you have laid out and I will educate myself a bit more. Every day that i wok more and more with WPF I "hate it less" and am starting to see the light. I will post my progress.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 May 2020 20:51:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/update-visibility-of-controls-in-dockpane/m-p/769003#M540</guid>
      <dc:creator>AbelPerez</dc:creator>
      <dc:date>2020-05-01T20:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Update Visibility of Controls in Dockpane</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/update-visibility-of-controls-in-dockpane/m-p/769004#M541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stepping through your snippets I think I get it now.&amp;nbsp; It was being lost on me in the community samples because they had so much going on. Coming from WinForms I'm not used to so many hooks. A suggestion...a very simple article or just maybe this post would do wonders for most developers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for your suggestions on where to&amp;nbsp;Subscribe I prefer the first method. Only for the simple fact that on the second one you have to add the&amp;nbsp;&lt;STRONG&gt;Await Task.Run&lt;/STRONG&gt; so it doesn't throw an exception. The community sample has&amp;nbsp; &lt;STRONG&gt;await UpdateSymbolList();&lt;/STRONG&gt; which its way to do async.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will continue with the video you have posted and I will also try the search method you described.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many, MANY Thanks!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 May 2020 22:05:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/update-visibility-of-controls-in-dockpane/m-p/769004#M541</guid>
      <dc:creator>AbelPerez</dc:creator>
      <dc:date>2020-05-01T22:05:56Z</dc:date>
    </item>
  </channel>
</rss>

