CheckComboBox Help

Open
#1,752 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
csharp
Domain
desktop

Research direction

The report names the CheckComboBox XAML and the CirculationData and ComboCirculation01_ItemSelectionChanged entry points, but no repository files or tests. Start by reproducing the three reported selection cases with the XML-backed ItemsSource; the work is complete when each case has a confirmed outcome and the expected selected values are clear.

Written by the indexing model from the issue text.

Description

HI,
I'm trying to use the CheckComboBox control, I take the data from an XML file, which is present in a folder on the computer, to be exact "C:\Emergency\Configuration\Configuration.xml" I used xmlDocument to import the file , and then through a foreach I added the various items, but I have two problems.

  1. If I select only one item it is not shown
  2. If I select two elements they are shown, but if I deselect them, the last deselected element is also shown
  3. Question: How can I get the values pressed on 2 or more different strings?

Thank you so much :)

XAML CODE

<xctk:CheckComboBox Grid.Column="1" Grid.Row="4" x:Name="ComboCirculation01" Height="30" Width="200" HorizontalAlignment="Center" VerticalAlignment="Center" DisplayMemberPath="Color" ValueMemberPath="Level" SelectedValue="{Binding SelectedValue}" SelectedItemsOverride="{Binding SelectedItems}"/>

CS CODE

` #region Circulation

    public class CirculationItem {
        public string Circulation { get; set; }
        public bool IsSelected { get; set; }
    }

    private void CirculationData() {
        string configFile = @"C:\Emergenza\Configuration\Configuration.xml";

        XmlDocument xmlDocument = new XmlDocument();
        xmlDocument.Load(configFile);

        XmlNodeList nodes = xmlDocument.SelectNodes("/Config/Paziente/Associazione/Circolo/Value");

        ComboCirculation01.DisplayMemberPath = "Circulation"; 

        List<CirculationItem> circulationItems = new List<CirculationItem>();
         
        foreach (XmlNode node in nodes) {
            string circulation = node.InnerText;
            circulationItems.Add(new CirculationItem { Circulation = circulation });
        }

        ComboCirculation01.ItemsSource = circulationItems;
        ComboCirculation01.ItemSelectionChanged += ComboCirculation01_ItemSelectionChanged;
    }

    private void ComboCirculation01_ItemSelectionChanged(object sender, Xceed.Wpf.Toolkit.Primitives.ItemSelectionChangedEventArgs e) {
        foreach (CirculationItem item in ComboCirculation01.Items) {
            item.IsSelected = ComboCirculation01.SelectedItems.Contains(item);
        }
    }

    #endregion`

Pastebin XAML CODE
Pastebin CS CODE

Dominant language
C#
Stars
4.2k
Forks
912
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from xceedsoftware/wpftoolkit

All issues in xceedsoftware/wpftoolkit

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.