9
Answers

Store checked items from CheckComboBox in a string array

TAN WhoAMI

TAN WhoAMI

10y
4.5k
1

From the Extended WPF Toolkit, we have the CheckComboBox.
in a ItemsSelectionChanged event, I wish to store those checked items in a string array, is that possible?
I try below:

it does not work according to my needs:
say "abc" and "def" items were checked.
it gives me selectedCostCenter[0]=abc,def
what I need is:
selectedCostCenter[0]=abc
selectedCostCenter[1]=def

how do I modify the code for my needs?
thanks.

Code below:
 

   private void CheckComboBox_CostCenter_ItemSelectionChanged(object sender, Xceed.Wpf.Toolkit.Primitives.ItemSelectionChangedEventArgs e)
        {
            int SelectedItemsTotal = CheckComboBox_CostCenter.SelectedItems.Count;
            string[] selectedCostCenter = new string[SelectedItemsTotal];
          

            for (i = 0; i < SelectedItemsTotal; i++)
            {
                selectedCostCenter[i] = CheckComboBox_CostCenter.SelectedValue.ToString();
            }
         }

Answers (9)