admin管理员组

文章数量:1135111

Background

I'm learning C#, WPF and MVVM design pattern and I'm trying to create a window with some controls.

One of these controls is a CheckCombobox taken from Xceed's Extended WPF Toolkit.

In this control, the property SelectedItemsOverride holds a collection of all the checked items, and I'm binding a list called SelectedFilterParameters to this property

The Problem

When the dropdown of the control closes after the user checked some items, no text is generated from the checked items, that represents the checked items. Instead the the text stays empty while there are indeed checked items in the control.

Worth mentioning && what I've tried

  • Data bindings and functionality of the window works great
  • Property DisplayMemberPath="ValueToString" is correct. ValueToString is also being used in the <TextBlock> tag below which works properly
  • I also tried DisplayMemberPath="{Binding ValueToString}". Didn't work
  • I added a RaisePropertyChange() upon setting the checked items List which is bound to the control's SelectedItemsOverride property
  • ItemsSource="{Binding ParameterValueList... is just a list holding all the instances. Binds successfully

.cs from which the problematic List is being bound, Bindable Base:

private IList<ParameterValueData> selectedFilterParameters;

/// <summary>
/// Selected parameters values, selected by the user using checkbox, to assign to the filter later under OR rule.
/// </summary>
public IList<ParameterValueData> SelectedFilterParameters 
{
    get { return selectedFilterParameters; } 
    set 
    { 
        selectedFilterParameters = value;
        RaisePropertyChanged();
    } 
}

*.xaml part in which I'm binding:

<DataGridTemplateColumn Header="Multiple Selection ComboBox" Width="199">
     <DataGridTemplateColumn.CellTemplate>
          <DataTemplate>
                <xctk:CheckComboBox
                    ItemsSource="{Binding ParameterValueList, UpdateSourceTrigger=PropertyChanged}"
                    Delimiter=", "
                    Width="200"
                    SelectedItemsOverride="{Binding SelectedFilterParameters, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
                    DisplayMemberPath="ValueToString"
                     >
                    <xctk:CheckComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding ValueToString}"/>
                        </DataTemplate>
                    </xctk:CheckComboBox.ItemTemplate>
                </xctk:CheckComboBox>
            </DataTemplate>
        </DataGridTemplateColumn.CellTemplate>
    </DataGridTemplateColumn>
</DataGrid.Columns>

Illustration

Desired text outcome:

CON18+5 Plaster, CON18+7 Plaster, CON20+2 Plaster

本文标签: cCheckCombobox Text property doesn39t work when user checks itemsStack Overflow