Hi,
We have a silverlight application with a menu view containing the ribbonbar and another view with the richtextbox. Is it possible to edit the contents of the richtextbox using prism commands and RichTextBoxCommands when user clicks a ribbonbarbutton eg. bold, insert image etc.
Update: We managed to make the views interact using some code like this:
But it would be better to resolve RadRichTextBox in our menu view so we can do something like this in the ribbonbar:
We have a silverlight application with a menu view containing the ribbonbar and another view with the richtextbox. Is it possible to edit the contents of the richtextbox using prism commands and RichTextBoxCommands when user clicks a ribbonbarbutton eg. bold, insert image etc.
Update: We managed to make the views interact using some code like this:
public
RichTextBoxViewModel(IEventAggregator eventAggregator, IUnityContainer container)
{
_container = container;
eventAggregator.GetEvent<HtmlEditorCommandsEvent>().Subscribe(OnHtmlEditorCommand,
true
);
}
private
void
OnHtmlEditorCommand(
string
param)
{
var radRichTextBox = _container.Resolve<RadRichTextBox>();
switch
(param)
{
case
HtmlEditorCommands.InsertPictureCommand:
var command =
new
InsertPictureCommand(radRichTextBox);
command.Execute();
break
;
default
:
break
;
}
}
But it would be better to resolve RadRichTextBox in our menu view so we can do something like this in the ribbonbar:
DataContext="{Binding Path=Commands,ElementName=_container.Resolve<
RadRichTextBox
>()}"
How can we achieve this in the menu viewmodel?
Br,
Ahmet