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

OpenDocumentCommand not working

3 Answers 18 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Dietmar
Top achievements
Rank 1
Dietmar asked on 16 Jul 2018, 10:09 AM
Hi,

 

I tried to open a document using the OpenDocumentCommand but it's not working.

Could you provide me some information how to achieve this?

Btw: SaveCommand opens the SaveFileDialog as expected.

 

best regards

Dietmar

 
<Window
    x:Class="telerikrtbtest.MainWindow"
    xmlns:local="clr-namespace:telerikrtbtest"
    Title="MainWindow"
    Width="525"
    Height="350"
    mc:Ignorable="d">
    <Grid>
        <Grid.Resources />
 
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
 
        <telerik:RadRibbonButton
            x:Name="OpenDocumentButton"
            Margin="0,2,2,2"
            telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding OpenDocumentCommand}"
            Content="open"
            DataContext="{Binding Commands, ElementName=richTextBoxAdv}" />
 
        <telerik:RadRichTextBox x:Name="radRichTextBox" Grid.Row="1" />
 
 
    </Grid>
</Window>

3 Answers, 1 is accepted

Sort by
0
Dietmar
Top achievements
Rank 1
answered on 16 Jul 2018, 12:22 PM

I get an exception on fireing the command.

 

"System.ArgumentException" in PresentationFramework.dll

0
Accepted
Tanya
Telerik team
answered on 19 Jul 2018, 07:26 AM
Hi Dietmar,

Thank you for sharing the sample code.

To ensure that the commands of RadRichTextBox can be bound as expected to the different controls, you will need to ensure that the name of the RadRichTextBox instance is the same as the one passed as ElementName for the binding. In the sample code, both names are different and the binding is not working. Here is how I changed the code:
<telerik:RadRibbonButton
    x:Name="OpenDocumentButton"
    Margin="0,2,2,2"
    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding OpenDocumentCommand}"
    Content="open"
    DataContext="{Binding Commands, ElementName=radRichTextBox}" />
 
<telerik:RadRichTextBox x:Name="radRichTextBox" Grid.Row="1" />

Hope this is helpful.

Regards,
Tanya
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.
0
Dietmar
Top achievements
Rank 1
answered on 27 Jun 2019, 07:36 PM

Hi Tanya!

Thank you!

Best regards

Tags
RichTextBox
Asked by
Dietmar
Top achievements
Rank 1
Answers by
Dietmar
Top achievements
Rank 1
Tanya
Telerik team
Share this question
or