Completed
Last Updated: 13 Aug 2026 09:40 by ADMIN
Release Telerik UI for WPF 2026.3.812 (Q3 2026)
Martin Ivanov
Created on: 30 Apr 2026 20:01
Category: RichTextBox
Type: Bug Report
0
RichTextBox: Duplicated default ListItem entry in the DropDownList content form on XAML import

When a DropDownList SDT form is saved in a XAML document and then imported with the XamlFormatProvider, an extra ListItem entry is added in the items collection of the DropDownList. The extra entry is the default "Choose an item".

To work this around, iterate all ComboBoxProperties and manually remove duplicates of the "Choose an item" entry.

var dropDownLists = radRichTextBox.Document.EnumerateChildrenOfType<SdtRangeStart>()
     .Where(x => x.SdtProperties is ComboBoxProperties)
     .Select(x => x.SdtProperties).OfType<ComboBoxProperties>();
 var defaultItemString = LocalizationManager.GetString("Documents_ContentControlsGenerator_ListItem");
 foreach (var item in dropDownLists)
 {
     if (item.Items.Count > 0 && item.Items.Any(x => x.Value != defaultItemString) && item.Items.Any(x => x.Value == defaultItemString))
     {
         var occurrence = item.Items.FirstOrDefault(x => x.Value == defaultItemString);
         while (occurrence != null)
         {
             item.Items.Remove(occurrence);
             occurrence = item.Items.FirstOrDefault(x => x.Value == defaultItemString);
         }
     }
 }

0 comments