RadRichTextBox binding ViewModel to RadRibbonBackstageItem

3 posts, 0 answers
  1. Tom
    Tom avatar
    6 posts
    Member since:
    Feb 2017

    Posted 03 Nov 2017 Link to this post

    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. Tom
    Tom avatar
    6 posts
    Member since:
    Feb 2017

    Posted 14 Nov 2017 in reply to Tom Link to this post

    Any suggestion? I can't solve this problem.
  3. Boby
    Admin
    Boby avatar
    643 posts

    Posted 16 Nov 2017 Link to this post

    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.
Back to Top