Disable an active dockpane based on SDK state

3683
7
06-27-2016 04:00 AM
by Anonymous User
Not applicable

I have a condition defined in my DAML which prevents my dockpanes from loading if the state is false. This works as expected, and the dockpanes correctly become enabled when the state becomes true. However, when the state changes to false again, the dockpanes remain enabled, why is this? My tab buttons respond correctly to the state being disabled again, but my dockpanes are unaffected. How can I get them to respond to the state changing to false again?

Regards,

Luke

0 Kudos
7 Replies
UmaHarano
Esri Regular Contributor

Hi Luke

To hide the controls in your dockpane, you can bind them in the xaml to a Visibility property in your dockpane. Toggle the visibility property based on your state activation\deactivation code.

Here is a sample:

dockpaneViewModel vm = FrameworkApplication.DockPaneManager.Find("viewmodel_id") as dockpaneViewModel ;
                if (criteria)
                {
                    //activate state
                    FrameworkApplication.State.Activate(StateId); //Activates the custom state when the context is set.

                    if (vm != null)
                    {
                        vm.DockpaneVisible = Visibility.Visible; 
                        .....
                    }
                   
                }
                else
                {
                    FrameworkApplication.State.Deactivate(StateId);
                    if (vm != null)
                        vm.DockpaneVisible = Visibility.Collapsed;
                }

Thanks

Uma Harano

ArcGIS Desktop SDK Team

0 Kudos
by Anonymous User
Not applicable

Hi Uma,

Not exactly the answer I was hoping for. Can't the dockpane respond automatically to the change in state like the controls in my tab do? After all, i've set the condition property of the dockpane in the XAML, so why isn't it honored? I want the delayLoadMessage string to reappear on the dockpane when the condition turns false.

Are the dockpanes not periodically checking this condition once they've loaded? Seems like a lot of work to manually hook up visibility properties to all my dockpanes controls when it should be handled automatically by the condition.

Simply put - I have a button that loads a map and toggles the state to true, then the dockpanes load. But then I have another button that closes the map, and toggles the state to false again. I just want the dockpanes to detect this and disable again based on the condition I set in the XAML.

Does this make sense?

Many thanks,

Luke

0 Kudos
by Anonymous User
Not applicable

Hi Uma Harano

Can you offer any further comments on this? Is what i'm describing not possible with the SDK?

Regards,

Luke

0 Kudos
UmaHarano
Esri Regular Contributor

Hi Luke

The "condition" attribute of the dockpane element in the config.daml is deprecated. It cannot be used to control the visibility of the controls inside the dockpane.

Thanks

Uma Harano

0 Kudos
deleted-user-WOOhbEScR4vX
New Contributor

Is the "condition" attribute still deprected? Can you then please update this site:

ProGuide DockPanes · Esri/arcgis-pro-sdk Wiki · GitHub 

It says:

Dockpanes can be established with a condition so that their content only appears when the condition is satisfied. If the dockpane is visible and the condition is not met, use the delayLoadMessage attribute to display a message in the dockpane UI.

0 Kudos
UmaHarano
Esri Regular Contributor

Thanks Oliver! I will update the wiki. Good catch.

0 Kudos
Vidar
by
Occasional Contributor II

Can the daml schema be modified so that "condition" is not even an option for dockpanes. Have a wasted a few hours on this because I can use "condition" and there is nothing to stop me doing so.

0 Kudos