Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
865
Subclassing a TextEditor - updating text in real time
posted

I have subclassed a text editor in order to encapsulate the presence of a ButtonsRight with custom drop down control. 

My subclassed editor and the control share a ViewModel. An IEditorDataFilter is provided to translate between the text representation in the text editor portion of the edtior control and the data shown in the custom control drop down.

So far I have been unable to figure out how to make the TextEditor re-run the EditorToDisplay conversion when changes are made in the drop down control.

My attempt so far has been to capture the INotifyPropertyChanged events that are raised by the ViewModel and convert them to edtior property changed events with the following code.

OnPropertyChanged(new PropertyChangedEventArgs(new PropChangeInfo(this, PropertyID.Value, null)));

This does not work, but I can't figure out what I would need to do to make the editor re-run the data filter.

Regards,

Mark

Parents
  • 69832
    Offline posted

    Generally speaking the IEditorDataFilter interface was not designed to accommodate manually triggering the conversions, but rather to give you a way to intercept the passing of data between the editor and owner during the normal course of operations.

    By default UltraComboEditor (closest analog to what you have going on here) triggers the EditorToDisplay conversion by updating the textbox contents when (for example) the user selects an item from the list. Since you are presumably already doing this manually, I don't think you have anything to gain by going through that interface. Simply setting the UltraTextEditor's Text property when the dropdown closes is basically the equivalent of the IEditorDataFilter's EditorToDisplay conversion., at least for a dropdown-like control.

Reply Children