<?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: Tree list with check boxes or ListBox with multiple selections within an ArcGIS PRO SDK pane in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/tree-list-with-check-boxes-or-listbox-with/m-p/1018019#M6022</link>
    <description>&lt;P&gt;You can look at this sample:&amp;nbsp;&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/RemoveAddins" target="_blank"&gt;arcgis-pro-sdk-community-samples/Framework/RemoveAddins at master · Esri/arcgis-pro-sdk-community-samples (github.com)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jan 2021 18:03:32 GMT</pubDate>
    <dc:creator>Wolf</dc:creator>
    <dc:date>2021-01-19T18:03:32Z</dc:date>
    <item>
      <title>Tree list with check boxes or ListBox with multiple selections within an ArcGIS PRO SDK pane</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/tree-list-with-check-boxes-or-listbox-with/m-p/1017571#M6011</link>
      <description>&lt;P&gt;Using ArcGIS Pro SDK 2.6, I am trying to create a ListBox where the user could select more than 1 item (holding shift / Ctrl key + click)&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I can create the listbox and handle the {ItemSource Binding} (for updating the list) and the {SelectedItem Binding} for handling the case of having &lt;STRONG&gt;one item&lt;/STRONG&gt; clicked on, using&amp;nbsp;&lt;SPAN&gt;RelayCommand().&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;How do I configure the Pane ListBox item to &lt;STRONG&gt;allow for multi-line selection&lt;/STRONG&gt;?&lt;BR /&gt;&lt;BR /&gt;thank you&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ex ref:&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Framework/DockpaneSimple/DockpaneSimple%20(C%23).md" target="_blank" rel="noopener"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Framework/DockpaneSimple/DockpaneSimple%20(C%23).md&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 04:04:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/tree-list-with-check-boxes-or-listbox-with/m-p/1017571#M6011</guid>
      <dc:creator>FredericPoliart_EsriAU</dc:creator>
      <dc:date>2021-01-18T04:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Tree list with check boxes or ListBox with multiple selections within an ArcGIS PRO SDK pane</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/tree-list-with-check-boxes-or-listbox-with/m-p/1017577#M6013</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/435620"&gt;@FredericPoliart_EsriAU&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;To enable multiple selections the shift/control modifiers, we just need to set SelectionMode="Extended" in the properties of the ListBox control in the associated XAML file.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;See Microsoft reference: &lt;A href="https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.listbox?view=net-5.0#remarks" target="_blank"&gt;https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.listbox?view=net-5.0#remarks&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;BR /&gt;James&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 04:26:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/tree-list-with-check-boxes-or-listbox-with/m-p/1017577#M6013</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-01-18T04:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Tree list with check boxes or ListBox with multiple selections within an ArcGIS PRO SDK pane</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/tree-list-with-check-boxes-or-listbox-with/m-p/1017579#M6014</link>
      <description>&lt;P&gt;thank you @Anonymous User&amp;nbsp; &amp;nbsp;&lt;BR /&gt;Now next question : How do I get the list of selected items in my ICommand RelayCommand() function?&lt;BR /&gt;Is there a special {binding} required?&amp;nbsp; (ex:&amp;nbsp; Binding SelectedItem array?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Severity Code Description Project File Line Suppression State&lt;BR /&gt;Error XDG0013 The property "SelectedItems" does not have an accessible setter.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 04:47:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/tree-list-with-check-boxes-or-listbox-with/m-p/1017579#M6014</guid>
      <dc:creator>FredericPoliart_EsriAU</dc:creator>
      <dc:date>2021-01-18T04:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: Tree list with check boxes or ListBox with multiple selections within an ArcGIS PRO SDK pane</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/tree-list-with-check-boxes-or-listbox-with/m-p/1017824#M6018</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/435620"&gt;@FredericPoliart_EsriAU&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You can bind the UI with isselected property in xaml&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;LI-CODE lang="markup"&gt;&amp;lt;ListBox ItemsSource="{Binding Items}" SelectionMode="Extended"&amp;gt;
    &amp;lt;ListBox.ItemContainerStyle&amp;gt;
        &amp;lt;Style TargetType="ListBoxItem"&amp;gt;
            &amp;lt;Setter Property="IsSelected" Value="{Binding IsSelected}" /&amp;gt;
        &amp;lt;/Style&amp;gt;
    &amp;lt;/ListBox.ItemContainerStyle&amp;gt;
&amp;lt;/ListBox&amp;gt;&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;So as in above example, in your model , there should be property call IsSelected as boolean type.&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;LI-CODE lang="csharp"&gt;private bool _isSelected;
public bool IsSelected
{
    get { return _isSelected; }
    set
    {
        _isSelected = value;
        this.NotifyPropertyChanged();
    }
}&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;And from you relay command, you can access selected item by&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;LI-CODE lang="csharp"&gt;Items.Where(i =&amp;gt; i.IsSelected);&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;There is no SelectedItems property in listbox control but you can extend it to enable it.&lt;/P&gt;&lt;P&gt;Below is the custom listbox control class example, you can bind with IList collection type. (any object list you can use)&lt;/P&gt;&lt;P&gt;But I would recommend you to use isselected property approach because It is more straight forward.&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;LI-CODE lang="csharp"&gt;using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace ThanExtendControlLibrary.ExtendedControls
{
    public class CustomListBox : ListBox
    {
        public CustomListBox()
        {

            this.SelectionChanged += CustomListbox_SelectionChanged;            
        }

        private void CustomListbox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            this.SelectedItemsList = this.SelectedItems;
        }
        #region SelectedItemsList

        public IList SelectedItemsList
        {
            get { return (IList)GetValue(SelectedItemsListProperty); }
            set { SetValue(SelectedItemsListProperty, value); }
        }
       

        public static readonly DependencyProperty SelectedItemsListProperty =
                DependencyProperty.Register("SelectedItemsList", typeof(IList), typeof(CustomListBox), new PropertyMetadata(null));
       
        #endregion
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As in above extended control you can use it from your dockpane with&lt;/P&gt;&lt;P&gt;Add xmlns:local="clr-namespace: ThanExtendControlLibrary.ExtendedControls;assembly=[your assemblyname]:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;local:CustomListBox  ItemsSource="{Binding Items}" SelectionMode="Extended" 
 SelectedItemsList="{Binding Path=SelectedList, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"&amp;gt;
   
&amp;lt;/local:CustomListBox&amp;gt;

&amp;lt;!-- Note: Declare SelectedList as IList in the model --&amp;gt;&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;</description>
      <pubDate>Tue, 19 Jan 2021 02:21:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/tree-list-with-check-boxes-or-listbox-with/m-p/1017824#M6018</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-01-19T02:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: Tree list with check boxes or ListBox with multiple selections within an ArcGIS PRO SDK pane</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/tree-list-with-check-boxes-or-listbox-with/m-p/1017839#M6019</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/435620"&gt;@FredericPoliart_EsriAU&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;That error you're seeing&amp;nbsp;&lt;SPAN&gt;XDG0013 The property "SelectedItems" does not have an accessible setter.&amp;nbsp; is a result of the fact that unlike the SelectedItem property, the SelectedItems property is read-only.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The simplest approach I can I think of would be to handle the SelectionChanged event of the ListBox in the codebehind to execute a command in the view model, and pass the selected items from the event handler to the command.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Using the DockpaneSimple project as an example, this would involve the following changes-&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;BookmarkDockpaneViewModel.cs&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// added to #region Private Properties
private ICommand _retrieveSelectedBookmarksCommand;

// added to #region Public Properties
public ICommand RetrieveSelectedBookmarksCommand =&amp;gt; _retrieveSelectedBookmarksCommand;

// addded to BookmarkDockpaneViewModel() constructor 
_retrieveSelectedBookmarksCommand = new RelayCommand((selectedBookmarks) =&amp;gt; RetrieveSelectedBookmarks(selectedBookmarks), () =&amp;gt; true);

//added to #region Private Helpers
private void RetrieveSelectedBookmarks(object param)
{
	System.Collections.IList selectedItems = (System.Collections.IList)param;

	Debug.WriteLine(selectedItems.Count);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;BookmarkDockpane.xaml.cs&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;//added to public partial class BookmarkDockpaneView : UserControl

private void lstBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
	var listSelectedItems = ((ListBox)sender).SelectedItems;

	var vm = (BookmarkDockpaneViewModel)this.DataContext;
	vm.RetrieveSelectedBookmarksCommand.Execute(listSelectedItems);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;BookmarkDockpane.xaml&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;ListBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Name="LstBookmarks"  SelectionMode="Extended"
		 ItemsSource="{Binding ListOfBookmarks}" Margin="5" 
		 DisplayMemberPath="Name" SelectionChanged ="lstBox_OnSelectionChanged"
		 BorderBrush="{DynamicResource Esri_BorderBrush}" BorderThickness="2"
		 ItemContainerStyle="{DynamicResource Esri_ListBoxItemHighlightBrush}"/&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 03:25:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/tree-list-with-check-boxes-or-listbox-with/m-p/1017839#M6019</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-01-19T03:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: Tree list with check boxes or ListBox with multiple selections within an ArcGIS PRO SDK pane</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/tree-list-with-check-boxes-or-listbox-with/m-p/1018019#M6022</link>
      <description>&lt;P&gt;You can look at this sample:&amp;nbsp;&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/RemoveAddins" target="_blank"&gt;arcgis-pro-sdk-community-samples/Framework/RemoveAddins at master · Esri/arcgis-pro-sdk-community-samples (github.com)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 18:03:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/tree-list-with-check-boxes-or-listbox-with/m-p/1018019#M6022</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-01-19T18:03:32Z</dc:date>
    </item>
  </channel>
</rss>

