ArcGIS Pro中改变How can Combobox selection change Checkbox isChecked


internal class Module1 : Module
  {
    private static Module1 _this = null;
    //Capture the checkbox here
    public CheckBox CheckBox { get; set; } = null;

//Eg a ribbon or "DAML" combo
internal class ComboBox1 : ComboBox {
 ...
 protected override void OnSelectionChange(ComboBoxItem item) {
   //have we been "made" before the checkbox?
   if (Module1.Current.CheckBox == null)
    //load it then
    _  = FrameworkApplication.GetPlugInWrapper("ProAppModule1_CheckBox1");

   //Check/Uncheck
   Module1.Current.CheckBox.IsChecked = !Module1.Current.CheckBox.IsChecked;
   ...

//DAML Checkbox on the ribbon
internal class CheckBox1 : CheckBox {

  public CheckBox1() {
    //wire up the Module property
    Module1.Current.CheckBox = this;
  }
  //handle on click for when the user _does_ actually click it
  protected override void OnClick() {
    //TODO - whatever u need to do to keep everything in-sync
    //...
    base.OnClick();
  }

相关