How to get the IsChecked.Value from checkbox in addin

211
2
Jump to solution
10-07-2018 06:11 AM
Highlighted
Occasional Contributor II

Hi,

I saw this example ProGuide Checkboxes for checkboxes in ArcGIS Pro addins.

I have created a checkbox class in Checkbox1.cs.

But how can I use the IsChecked.Value in Module1.cs? If the checkbox ischecked, a script should copy the project to another place after ProjectClosed state.

Thanks Karsten

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Esri Regular Contributor

Hi Karsten,

You could create a public static property in the module class and set that to the check box's IsChecked property.

class ProCheckbox : ArcGIS.Desktop.Framework.Contracts.CheckBox
    {
        public ProCheckbox()
        {
            IsChecked = true;
           
        }

        protected override void OnClick()
        {
            // TODO - add specific customization here as necessary
            //Module1.CheckBoxIsChecked is a public static property in the module class file.
            Module1.CheckBoxIsChecked = IsChecked.HasValue ? IsChecked.Value : false;
            MessageBox.Show($"Checked: {Module1.CheckBoxIsChecked}");
        }
    }

View solution in original post

2 Replies
Highlighted
Esri Regular Contributor

Hi Karsten,

You could create a public static property in the module class and set that to the check box's IsChecked property.

class ProCheckbox : ArcGIS.Desktop.Framework.Contracts.CheckBox
    {
        public ProCheckbox()
        {
            IsChecked = true;
           
        }

        protected override void OnClick()
        {
            // TODO - add specific customization here as necessary
            //Module1.CheckBoxIsChecked is a public static property in the module class file.
            Module1.CheckBoxIsChecked = IsChecked.HasValue ? IsChecked.Value : false;
            MessageBox.Show($"Checked: {Module1.CheckBoxIsChecked}");
        }
    }

View solution in original post

Highlighted
Occasional Contributor II

Thank you Uma!
This was what I searched!

0 Kudos