We are currently migrating a legacy system to .NET and part of my task is to design a UI framework that is able to integrate into our existing structure with as little friction as possible. For this purpose, I have written small wrapper controls that offer the interface we need, internally use Telerik controls, and translate as necessary between both.
One of the requirements is that, after selecting a dropdown item, the ComboBox itself does not decide which data to display in its TextBox. Rather, a different object will be informed about which index was selected and will set the desired text for the RadComboBox (and may also do various other things, dependent on the ComboBox and the selected index). As things currently are, the RadComboBox will automatically fill its TextBox with the result of a .ToString() of the selected dropdown item/business object. Almost immediately afterwards, our "deciding" object will overwrite the text with the desired value. This produces an unwanted flickering.
I did not find any way of telling an editable RadComboBox to stop setting its own text. I have tried setting the TextSearch.TextPath Property to an invalid value, which kind of looks better (it sets an empty string as the text, which looks more like a delay than flickering), but it triggers an ArgumentException (that is automatically swallowed), which is ugly, and comes with a noticeable delay. I have also tried handling various events (such as SelectionChanged, or the routed TextBoxBase.TextChanged Event) and setting the Handled Property of the EventArgs when we want to stop this event - but that was consequently ignored by the RadComboBox.
A similar problem was the automatic overwriting of the TextBox text when navigating the dropdown with the keyboard; Setting the CanKeyboardNavigationSelectItems property to false was the solution to that. Is a similar solution available to the problem described above, or is the setting-text-to-TextBox-on-selection baked in so much that it would be better for us to look for alternative ideas?
One of the requirements is that, after selecting a dropdown item, the ComboBox itself does not decide which data to display in its TextBox. Rather, a different object will be informed about which index was selected and will set the desired text for the RadComboBox (and may also do various other things, dependent on the ComboBox and the selected index). As things currently are, the RadComboBox will automatically fill its TextBox with the result of a .ToString() of the selected dropdown item/business object. Almost immediately afterwards, our "deciding" object will overwrite the text with the desired value. This produces an unwanted flickering.
I did not find any way of telling an editable RadComboBox to stop setting its own text. I have tried setting the TextSearch.TextPath Property to an invalid value, which kind of looks better (it sets an empty string as the text, which looks more like a delay than flickering), but it triggers an ArgumentException (that is automatically swallowed), which is ugly, and comes with a noticeable delay. I have also tried handling various events (such as SelectionChanged, or the routed TextBoxBase.TextChanged Event) and setting the Handled Property of the EventArgs when we want to stop this event - but that was consequently ignored by the RadComboBox.
A similar problem was the automatic overwriting of the TextBox text when navigating the dropdown with the keyboard; Setting the CanKeyboardNavigationSelectItems property to false was the solution to that. Is a similar solution available to the problem described above, or is the setting-text-to-TextBox-on-selection baked in so much that it would be better for us to look for alternative ideas?