Pending Review
Last Updated: 26 Nov 2024 07:55 by Nico

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);
    }
}