Is it possible, from the viewmodel, to the same thing?
2 Answers, 1 is accepted
answered on 25 Jul 2018, 01:20 PM
To insert a merge field, you should have access to the document or the RadRichTextBox instance from the view model. If you can obtain the document, you can use the methods of RadDocumentEditor to insert the field. Would this be an option for you?
In case you would like to implement a pure MVVM approach, this would be more complex. You could create your own attached behaviors (similar to what is done with the RadRichTextBoxRibbonUI.RichTextCommand) and put the implementation there. An example could be found in the Attached Behavior/Properties help article, and some blog posts over the internet, for example, this one. In the original implementation of the logic in RadRichTextBox, we pass the corresponding command as value to the attached property, and in the code behind attach an event handler to the corresponding event.
Hope this helps.
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.