<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can Combobox selection change Checkbox isChecked in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-can-combobox-selection-change-checkbox/m-p/1151508#M7895</link>
    <description>&lt;P&gt;Hello,&amp;nbsp; I attached a screen shot for your reference.&amp;nbsp; I started off with a dockpane and the combobox and checkbox combination works.&amp;nbsp; I have a variable that is set when the user selects a point layer from the combobox.&amp;nbsp; The variable is true/false as to whether the selected layer contains selected features.&amp;nbsp; The checkbox uses databinding and connects its IsChecked setting to the variable.&amp;nbsp; This works.&amp;nbsp; Now as I have been developing this tool I&amp;nbsp; decided that perhaps all the users settings that appear in the dockpane should be on a properties page instead.&amp;nbsp; Now if i move all my properties off the dockpane, there isn't much left so I moved the combobox and two checkboxes along with the run button to the ribbon.&amp;nbsp; I just can't get the checkboxes to change when the combobox item is changed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ComboBox.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/35796i80488F09B710AA96/image-size/large?v=v2&amp;amp;px=999" role="button" title="ComboBox.png" alt="ComboBox.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is what the tool creates&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sample.png" style="width: 581px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/35797i783F43672D084E2A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Sample.png" alt="Sample.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Mar 2022 21:35:39 GMT</pubDate>
    <dc:creator>JonathanDewalt</dc:creator>
    <dc:date>2022-03-07T21:35:39Z</dc:date>
    <item>
      <title>How can Combobox selection change Checkbox isChecked</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-can-combobox-selection-change-checkbox/m-p/1151383#M7893</link>
      <description>&lt;P&gt;Hello,&amp;nbsp; I can do this blindfolded with the old ArcObjects and windows forms.&amp;nbsp; But am either getting old or something because it has me stumped with the new pro DAML model.&amp;nbsp; &amp;nbsp;I have a combobox defined in DAML that resides on the ribbon.&amp;nbsp; I also have a checkbox.&amp;nbsp; The comobox contains a list of point-based feature layers.&amp;nbsp; What I want to happen, is when a user selects a layer from the combobox, I want the checkbox isChecked to be set to true if the selected layer contains selected features.&amp;nbsp; I have no problem getting the selection feature count but I have no idea how to get to the checkbox to set its value.&amp;nbsp; Is there a way to reference the checkbox from the combobox?&amp;nbsp; I have also created a variable in the module that both can see controls can see but changes to the variable don't migrate back to the checkbox.&amp;nbsp; In the old days, I would either directly reference the checkbox from the combobox or have a public event that the checkbox is listening for.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 17:58:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-can-combobox-selection-change-checkbox/m-p/1151383#M7893</guid>
      <dc:creator>JonathanDewalt</dc:creator>
      <dc:date>2022-03-07T17:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: How can Combobox selection change Checkbox isChecked</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-can-combobox-selection-change-checkbox/m-p/1151490#M7894</link>
      <description>&lt;P&gt;Yes.&amp;nbsp; Completely agree.&amp;nbsp; XAML is definitely not as intuitive as WinForms but works well once you figure it out... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, I've not placed any checkboxes or combo boxes on the Ribbon as of yet.&amp;nbsp; I've mostly used the Ribbon a button to launch dockpane's and dialogs or a MapTool.&amp;nbsp; On Dockpane's and Dialog's you get a code behind (i.e. *.xaml.cs that is paired with the *.xaml page).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can almost picture what you're trying to do and see that it would be done using the Config.daml for your Add-In but if you could post a picture of the UI you're trying to implement that would help.&amp;nbsp; Also I think it is a bit easier if it's on a Dockpane or in a custom dialog but just my $0.02.&amp;nbsp; Where is the checkbox?&amp;nbsp; Is it on another button on the ribbon or somewhere else? Look forward to seeing what you got.&lt;/P&gt;&lt;P&gt;In that environment (i.e. dockpane or dialog) you assign a name to the CheckBox and you can reference it in your code-behind by that name as shown below:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// Checkbox in XAML with Name (Sample.xaml)
// ...
&amp;lt;CheckBox x:Name="cbMyCheckBox" IsChecked="false" /&amp;gt;
//...

// The checkbox in XAML above can be referenced in Sample.xaml.cs
// As shown below and the IsChecked is a read/write boolean property
void SomeMethod()
{
     cbMyCheckBox.IsChecked = true;
}&lt;/LI-CODE&gt;&lt;P&gt;May not be what you're asking but thought I'd show it anyway...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 20:48:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-can-combobox-selection-change-checkbox/m-p/1151490#M7894</guid>
      <dc:creator>DHuantes</dc:creator>
      <dc:date>2022-03-07T20:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can Combobox selection change Checkbox isChecked</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-can-combobox-selection-change-checkbox/m-p/1151508#M7895</link>
      <description>&lt;P&gt;Hello,&amp;nbsp; I attached a screen shot for your reference.&amp;nbsp; I started off with a dockpane and the combobox and checkbox combination works.&amp;nbsp; I have a variable that is set when the user selects a point layer from the combobox.&amp;nbsp; The variable is true/false as to whether the selected layer contains selected features.&amp;nbsp; The checkbox uses databinding and connects its IsChecked setting to the variable.&amp;nbsp; This works.&amp;nbsp; Now as I have been developing this tool I&amp;nbsp; decided that perhaps all the users settings that appear in the dockpane should be on a properties page instead.&amp;nbsp; Now if i move all my properties off the dockpane, there isn't much left so I moved the combobox and two checkboxes along with the run button to the ribbon.&amp;nbsp; I just can't get the checkboxes to change when the combobox item is changed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ComboBox.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/35796i80488F09B710AA96/image-size/large?v=v2&amp;amp;px=999" role="button" title="ComboBox.png" alt="ComboBox.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is what the tool creates&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sample.png" style="width: 581px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/35797i783F43672D084E2A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Sample.png" alt="Sample.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 21:35:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-can-combobox-selection-change-checkbox/m-p/1151508#M7895</guid>
      <dc:creator>JonathanDewalt</dc:creator>
      <dc:date>2022-03-07T21:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: How can Combobox selection change Checkbox isChecked</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-can-combobox-selection-change-checkbox/m-p/1151587#M7896</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;For your solution it is better to use "customControl" as in sample&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/RibbonControls" target="_self"&gt;RibbonControls&lt;/A&gt;&amp;nbsp;. You have to copy all controls you need from docpane xaml to custom control xaml and all code related to xaml to custom control viewmodel.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 06:30:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-can-combobox-selection-change-checkbox/m-p/1151587#M7896</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2022-03-08T06:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can Combobox selection change Checkbox isChecked</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-can-combobox-selection-change-checkbox/m-p/1151887#M7901</link>
      <description>&lt;P&gt;Ribbon controls defined in DAML are a bit different from _user_ controls defined in XAML (ie via WPF) as u mention. One possibility is to&amp;nbsp;store a reference to the ribbon checkbox in your Module. U will also have to deal with the situation of a/the combo box being clicked before the checkbox on the ribbon has been loaded (ie Ribbon controls are typically null until they are clicked).&lt;/P&gt;&lt;P&gt;Something like....&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;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();
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 20:08:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-can-combobox-selection-change-checkbox/m-p/1151887#M7901</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2022-03-08T20:08:22Z</dc:date>
    </item>
  </channel>
</rss>

