<?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 Where do methods (such as OnSelectionChange) for a combo box that is nested in a dockpane go? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/where-do-methods-such-as-onselectionchange-for-a/m-p/767257#M487</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is plenty of documentation on how to add&amp;nbsp;combo boxes to a toolbar/group from the daml and how to add functionality in the corresponding .cs file.&amp;nbsp; However, I haven't been able to find any documentation on how to put a combobox in the .xaml file for a dockpane and&amp;nbsp;reference methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The method I would like to reference is &lt;STRONG style="background-color: #ffffff; color: #24292e; font-weight: 600; "&gt;&lt;STRONG&gt;OnSelectionChange&lt;/STRONG&gt;&lt;/STRONG&gt;:&lt;BR /&gt;&lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Combo-boxes#determine-when-a-selection-occurs"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Combo-boxes#determine-when-a-selection-occurs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I have my combobox declared in the .xaml&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;DockPanel Grid.Row="2" Grid.Column="1"&amp;gt;&lt;BR /&gt; &amp;lt;ComboBox Name ="ProfileBox" &lt;BR /&gt; Width="Auto" Height="Auto" IsEditable="True" Background="{DynamicResource Esri_BackgroundPressedBrush}" ItemsSource="{Binding Profiles}" &lt;BR /&gt; Foreground="{DynamicResource Esri_TextMenuBrush}"&amp;gt; &lt;BR /&gt; &lt;BR /&gt; &amp;lt;/ComboBox&amp;gt;&lt;BR /&gt; &amp;lt;/DockPanel&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;and I am able to add items to a list and pass them as the source:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;foreach (var item in profileRead)&lt;BR /&gt; {&lt;BR /&gt; string name = Path.GetFileNameWithoutExtension(item);&lt;/P&gt;&lt;P&gt;_profiles.Add(name);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;private ObservableCollection&amp;lt;string&amp;gt; _profiles = new ObservableCollection&amp;lt;string&amp;gt;();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;public ObservableCollection&amp;lt;string&amp;gt; Profiles&lt;BR /&gt; {&lt;BR /&gt; set&lt;BR /&gt; {&lt;BR /&gt; SetProperty(ref _profiles, value, () =&amp;gt; Profiles);&lt;BR /&gt; NotifyPropertyChanged(() =&amp;gt; Profiles);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;get { return _profiles; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I was able to reference the selection from the xaml.cs file:&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;public partial class Dockpane1View : UserControl&lt;BR /&gt; {&lt;BR /&gt;public static ComboBox profileBoxRef = new ComboBox();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;public Dockpane1View()&lt;BR /&gt; {&lt;BR /&gt; InitializeComponent();&lt;BR /&gt;profileBoxRef = ProfileBox;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;However, I cannot figure out how to implement&amp;nbsp;&lt;SPAN style="color: #24292e; background-color: #ffffff; font-weight: 600;"&gt;&lt;STRONG&gt;OnSelectionChange.&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;JP&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Jun 2019 17:14:11 GMT</pubDate>
    <dc:creator>JohnPhillipsGeo</dc:creator>
    <dc:date>2019-06-03T17:14:11Z</dc:date>
    <item>
      <title>Where do methods (such as OnSelectionChange) for a combo box that is nested in a dockpane go?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/where-do-methods-such-as-onselectionchange-for-a/m-p/767257#M487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is plenty of documentation on how to add&amp;nbsp;combo boxes to a toolbar/group from the daml and how to add functionality in the corresponding .cs file.&amp;nbsp; However, I haven't been able to find any documentation on how to put a combobox in the .xaml file for a dockpane and&amp;nbsp;reference methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The method I would like to reference is &lt;STRONG style="background-color: #ffffff; color: #24292e; font-weight: 600; "&gt;&lt;STRONG&gt;OnSelectionChange&lt;/STRONG&gt;&lt;/STRONG&gt;:&lt;BR /&gt;&lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Combo-boxes#determine-when-a-selection-occurs"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Combo-boxes#determine-when-a-selection-occurs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I have my combobox declared in the .xaml&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;DockPanel Grid.Row="2" Grid.Column="1"&amp;gt;&lt;BR /&gt; &amp;lt;ComboBox Name ="ProfileBox" &lt;BR /&gt; Width="Auto" Height="Auto" IsEditable="True" Background="{DynamicResource Esri_BackgroundPressedBrush}" ItemsSource="{Binding Profiles}" &lt;BR /&gt; Foreground="{DynamicResource Esri_TextMenuBrush}"&amp;gt; &lt;BR /&gt; &lt;BR /&gt; &amp;lt;/ComboBox&amp;gt;&lt;BR /&gt; &amp;lt;/DockPanel&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;and I am able to add items to a list and pass them as the source:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;foreach (var item in profileRead)&lt;BR /&gt; {&lt;BR /&gt; string name = Path.GetFileNameWithoutExtension(item);&lt;/P&gt;&lt;P&gt;_profiles.Add(name);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;private ObservableCollection&amp;lt;string&amp;gt; _profiles = new ObservableCollection&amp;lt;string&amp;gt;();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;public ObservableCollection&amp;lt;string&amp;gt; Profiles&lt;BR /&gt; {&lt;BR /&gt; set&lt;BR /&gt; {&lt;BR /&gt; SetProperty(ref _profiles, value, () =&amp;gt; Profiles);&lt;BR /&gt; NotifyPropertyChanged(() =&amp;gt; Profiles);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;get { return _profiles; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I was able to reference the selection from the xaml.cs file:&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;public partial class Dockpane1View : UserControl&lt;BR /&gt; {&lt;BR /&gt;public static ComboBox profileBoxRef = new ComboBox();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;public Dockpane1View()&lt;BR /&gt; {&lt;BR /&gt; InitializeComponent();&lt;BR /&gt;profileBoxRef = ProfileBox;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;However, I cannot figure out how to implement&amp;nbsp;&lt;SPAN style="color: #24292e; background-color: #ffffff; font-weight: 600;"&gt;&lt;STRONG&gt;OnSelectionChange.&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;JP&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Jun 2019 17:14:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/where-do-methods-such-as-onselectionchange-for-a/m-p/767257#M487</guid>
      <dc:creator>JohnPhillipsGeo</dc:creator>
      <dc:date>2019-06-03T17:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Where do methods (such as OnSelectionChange) for a combo box that is nested in a dockpane go?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/where-do-methods-such-as-onselectionchange-for-a/m-p/767258#M488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;If you do not use MVVM then you could add event to your xaml file like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;ComboBox&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-family: Consolas; font-size: small;"&gt; x&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;:&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-family: Consolas; font-size: small;"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;="cbLayer"&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-family: Consolas; font-size: small;"&gt; Margin&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;="10"&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-family: Consolas; font-size: small;"&gt; Width&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;="150"&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-family: Consolas; font-size: small;"&gt; SelectionChanged&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;="Layer_SelectionChanged"&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;In xaml.cs you need to add method for SelectionChanged:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;private&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;void&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; Layer_SelectionChanged(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;object&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; sender, SelectionChangedEventArgs e)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;In&amp;nbsp;MVVM you do not need OnSelectionChange. You need to create property for SelectedItem or SelectedValue in your model view file and make binding in xaml&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;ComboBox&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-family: Consolas; font-size: small;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-family: Consolas; font-size: small;"&gt;ItemsSource&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-family: Consolas; font-size: small;"&gt; Layers&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;}"&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-family: Consolas; font-size: small;"&gt; SelectedItem&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-family: Consolas; font-size: small;"&gt; SelectedLayer&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;}"&lt;SPAN style="color: #0000ff; font-size: small; font-family: Consolas; "&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2019 06:23:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/where-do-methods-such-as-onselectionchange-for-a/m-p/767258#M488</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2019-06-04T06:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Where do methods (such as OnSelectionChange) for a combo box that is nested in a dockpane go?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/where-do-methods-such-as-onselectionchange-for-a/m-p/767259#M489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gintautas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That worked like a charm, thank you!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2019 11:49:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/where-do-methods-such-as-onselectionchange-for-a/m-p/767259#M489</guid>
      <dc:creator>JohnPhillipsGeo</dc:creator>
      <dc:date>2019-06-04T11:49:44Z</dc:date>
    </item>
  </channel>
</rss>

