Pending Review
Last Updated: 26 Nov 2024 07:55 by Nico
Nico
Created on: 26 Nov 2024 07:55
Category: ComboBox
Type: Feature Request
1
[Feature-Request] ComboBox: Add possibility that the SelectedItem does not have be present in the ItemSource but is still displayed.

At the moment, the SelectedItem is not displayed (as readonly text in the entry text) if it is not present in the ItemSource.I suspect this is by design (but maybe a bug?) Background: In my list there are elements that are readonly, i.e. can correspond to the current selection, but cannot be selected by the user if a change is made.At the moment, the ItemSource has to be cleaned of the readonly elements before it is assigned to the ComboBox.A suggested solution would therefore be: Add a FilterDescriptors property, as in the RadCollectionView. This is taken into account in the selection list, but not for the display of the SelectedItem

Dirty workarround vor the moment:


private void cb_Loaded(object sender, EventArgs e)
{
    if (sender is RadComboBox radComboBox)
    {
        IReadOnlyList<IVisualTreeElement> children = radComboBox.GetVisualTreeDescendants();
        RadEntry entry = children.OfType<RadEntry>().FirstOrDefault();
        //entry.Text = DataContextViewModel.SelectedFieldOptionText;
        entry?.Bind(RadEntry.TextProperty, static (IComboBoxViewModel x) => x.SelectedOptionText, source: DataContextViewModel);
    }
}

0 comments