Select to view content in your preferred language

How to get the IsChecked.Value from checkbox in addin

1171
2
Jump to solution
10-07-2018 06:11 AM
KarstenRank
Frequent Contributor

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
UmaHarano
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
UmaHarano
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}");
        }
    }
KarstenRank
Frequent Contributor

Thank you Uma!
This was what I searched!

0 Kudos