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
MarkAllanson said:Is the control "InEditMode" when the user clicks on one of the buttons right (which is set as a drop down button with custom control)?
I'm pretty sure it does. But you can check the IsInEditMode property to be sure.
I could get a textbox by casting the Editor property of the UltraTextEditor to an EditorWithText, then getting the textbox from there.
In edit mode though, the controls collection was empty.
Is the control "InEditMode" when the user clicks on one of the buttons right (which is set as a drop down button with custom control)?
That's not possible. If UltraTextEditor is in edit mode, there has to be a control in it's Controls collection. This control will only be there when the control is in edit mode, though. That means that it has focus and there's a blinking caret in the control. Or, you can set AlwaysInEditMode to true so that it stays in edit mode all the time.
I was hopeful when I saw your reply, but somehow there are no child controls of the ultratexteditor, at least it seems while in edit mode.
I think you probably should set the Value rather than the text. But this might not update the display while the control is in edit mode.
If setting the Value doesn't work, then I recommend that you set the Text directly on the TextBox which is contained by the UltraTextEditor. Something like:
TextBox textbox = this.Controls[0] as TextBox
if (textBox != null)
texbox.Text = ViewModel.ToString();