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