To reproduce: please refer to the attached gif file
Add a custom tab in the ribbon UI and a RadDropDownListElement bound to a list of strings. The first item is selected by default. Insert a table by using the ribbon UI and try to get programmatically the RadDropDownListElement.SelectedValue/Index. It is null/-1 although the text is correct.
Workaround:
public class CustomRichTextEditorRibbonBar : RichTextEditorRibbonBar
{
protected override void CreateChildItems(RadElement parent)
{
base.CreateChildItems(parent);
FieldInfo fi = typeof(RadRibbonBar).GetField("ribbonBarElement", BindingFlags.Instance | BindingFlags.NonPublic);
RadRibbonBarElement ribbonBarElement = fi.GetValue(this) as RadRibbonBarElement;
ribbonBarElement = new CustomRadRibbonBarElement();
fi.SetValue(this, ribbonBarElement);
this.RootElement.Children.Add(ribbonBarElement);
ribbonBarElement.CommandTabSelecting +=
delegate (object sender, CommandTabSelectingEventArgs args) { OnCommandTabSelecting(args); };
ribbonBarElement.CommandTabSelected +=
delegate (object sender, CommandTabEventArgs args) { OnCommandTabSelected(args); };
ribbonBarElement.ExpandedStateChanged += delegate (object sender, EventArgs args)
{
this.OnRibbonBarExpandedStateChanged(args);
};
}
}
public class CustomRadRibbonBarElement : RadRibbonBarElement
{
protected override float GetMaximumTabContentHeight()
{
return 104;
}
}