Select to view content in your preferred language

Disable Dockpane

916
2
Jump to solution
10-11-2020 10:55 PM
ModyBuchbinder
Esri Regular Contributor

Hi All

I have a dockpane with a few buttons. some of the buttons takes a while (running a few GP tools) and all the buttons depend on each other.

When I press a button I do not like the user to press any other button in the pane until the one that I pressed is finished.

All other panes, pan/zoom etc. should be active.

The way I found is to define IsEnable with binding for each button then when the button starts I set it to false and NotifyPropertyChanged.

This works but I need to do do it for each button.

I was hoping to find a general way to do it for all controls in the dockpane.

I was looking for Enable here: ArcGIS Pro 2.6 API Reference Guide  but it does not work.

Should I use conditions and how?

Thanks

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi Mody,

You can disable all dockpane controls by binding root grid IsEnabled to to your view model property.

Or you can put all your buttons to grid, stackpanel, toolbar, group or etc. and do the same as with all dockpane

View solution in original post

0 Kudos
2 Replies
GKmieliauskas
Esri Regular Contributor

Hi Mody,

You can disable all dockpane controls by binding root grid IsEnabled to to your view model property.

Or you can put all your buttons to grid, stackpanel, toolbar, group or etc. and do the same as with all dockpane

0 Kudos
by Anonymous User
Not applicable

Hi Mody Buchbinder‌,

If you want to disable the whole dockpane, you can follow like -

1. In your xaml (dockpane xaml) 

Add boolean binding, at the first xml tag after width height like => d:DesignHeight="300" d:DesignWidth="300" IsEnabled="{Binding Path=DockEnabled}"

2. In your view model c# class, add the property you bind in your xaml, 

 private bool dockEnabled;
        public bool DockEnabled
        {
            get { return dockEnabled; }
            set
            {
                SetProperty(ref dockEnabled, value, () => DockEnabled);
            }
        }

3. At constructor, assign it to true first

And subsequently if you want to disable the dockpane, assign it false.

If you need to call that variable in the QueuedTask block , call in that way

 Dispatcher.CurrentDispatcher.Invoke(() =>
            {
                this.DockEnabled = false;
            });

 

Let me know how's go, currently I am using 2.6.2 and play like this , it is working for me.