Quantcast
Channel: wpftoolkit Discussions Rss Feed
Viewing all articles
Browse latest Browse all 2157

New Post: CheckComboBox enqueries

$
0
0
I have 2 enqueries:

1st: How do I enable say first or second item (or first and second item) of the CheckComboBox to be checked upon Windows_Loaded?

2nd: Say I use the CheckComboBox to update a CheckListBox as below, in a ItemSelectionChanged event:

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

        for (int j = 0; j < SelectedItemsTotal; j++)
        {
            selectedCostCenter[j] = CheckComboBox_CostCenter.SelectedItems[j].ToString();
            FileInfo file = new FileInfo(string.Concat(path1, selectedCostCenter[j], ".txt"));
            StreamReader stRead = file.OpenText();
            while (!stRead.EndOfStream)
            {
                CheckListBox_TestSystems.Items.Add(stRead.ReadLine());
            }
            stRead.Close();
        }            
    }
When user says check Item1 from CheckComboBox_CostCenter, a CheckList_TestSystems would be populated with its items (say ItemA, ItemB, ItemC).
When user says check Item2 from CheckComboBox_CostCenter (with item1 unchecked), a CheckList_TestSystems would be populated with its items (say ItemD, ItemE, ItemF).
When user says check both Item 1 and Item2 from CheckComboBox_CostCenter, a CheckList_TestSystems would be populated with its items (say ItemA, ItemB, ItemC, ItemD, ItemE, ItemF).
Above works perfectly fine.

My main issue is this:
When user check Item1 from CheckComboBox_CostCenter, and ItemA, ItemB, ItemC will appear on its CheckList_TestSystems. Say now, I want to check ItemA. Next, I go to check Item2 from the CheckComboBox_CostCenter, with Item1 still remain checked. Now the CheckList_TestSystems is populated with ItemA, ItemB, ItemC, ItemD, ItemE, ItemF. But the previously checked of the ItemA will become UNCHECKED. I would like the checked ItemA to remain as it is when user click the Item2.

thanks.

Viewing all articles
Browse latest Browse all 2157

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>