This is a migrated thread and some comments may be shown as answers.

RadRichTextBox binding ViewModel to RadRibbonBackstageItem

2 Answers 119 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 03 Nov 2017, 02:02 PM

Hi,

I have a problem with bindning command (which is in parent ViewModel) to RadRibbonBackstageItem.

<UserControl x:Class="Project.TelerikEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:telerikViewModel ="clr-namespace:Project.Modules.TelerikEditor.ViewModel"
             xmlns:optionsViewModel="clr-namespace:Project.Modules.Options.ViewModel"
             d:DesignHeight="300"
             d:DesignWidth="900"
             mc:Ignorable="d" >
   <UserControl.DataContext>
        <telerikViewModel:TelerikEditorViewModel/>
    </UserControl.DataContext>

...........

...........

...........

<telerik:RadRibbonBackstageItem Header="Options"
                                                    Icon="{telerik:IconResource IconRelativePath=16/new.png,
                                                                                IconSources={StaticResource IconSources}}"
                                                    DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Mode=TwoWay}"
                                                    Command="{Binding OptionsWindowCommand }""
                                                    IsSelectable="false"
                                                    >

The Command don't pass to ViewModel.

Any suggestion?

 

2 Answers, 1 is accepted

Sort by
0
Tom
Top achievements
Rank 1
answered on 14 Nov 2017, 12:26 PM
Any suggestion? I can't solve this problem.
0
Boby
Telerik team
answered on 16 Nov 2017, 04:23 PM
Hi Tom,

 RadRibbonBackstageItem Command property should point to any of the commands in RadRichTextBox.Commands property, e.g. RadRichTextBox.Commands.NewDocumentCommand. So most probably in your case you would have to change DataContext to point to RadRichTextBox.Commands instance, instead of to UserControl.DataContext.

Regards,
Boby
Progress Telerik
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 allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
RichTextBox
Asked by
Tom
Top achievements
Rank 1
Answers by
Tom
Top achievements
Rank 1
Boby
Telerik team
Share this question
or