【问题标题】:Telerik RadRichTextBox not showing all Save As file typesTelerik RadRichTextBox 未显示所有另存为文件类型
【发布时间】:2026-02-06 00:15:02
【问题描述】:

我正在使用 Telerik RadRichTextBox 控件和 RadRichTextBoxRibbonUI 为我的用户提供一些新建、打开和另存为按钮。在我的另存为中,我没有看到 docx、pdf 或 html 的另存为类型选项。我只得到xaml。我想我的项目中缺少一些程序集引用,但我不知道是哪一个。这是一些代码。

<UserControl   x:Class="WpfControlLibrary1.MyView"
         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:iy="http://schemas.microsoft.com/expression/2010/interactivity"  
        xmlns:is="http://schemas.microsoft.com/expression/2010/interactions"
        xmlns:prism="http://www.codeplex.com/prism" 
         xmlns:local="clr-namespace:WpfControlLibrary1"  
           xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
           xmlns:telerikXaml="clr-namespace:Telerik.Windows.Documents.FormatProviders.Xaml;assembly=Telerik.Windows.Documents.FormatProviders.Xaml"
           xmlns:telerikPdf="clr-namespace:Telerik.Windows.Documents.FormatProviders.Pdf;assembly=Telerik.Windows.Documents.FormatProviders.Pdf"
           mc:Ignorable="d" 
         d:DesignHeight="300" d:DesignWidth="800">
<UserControl.Resources>        
    <ResourceDictionary>
        <DataTemplate x:Key="PopupWindow">
            <Grid Width="250" Height="200">
                <TextBlock Text="Hello"></TextBlock>
            </Grid>
        </DataTemplate>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Dictionary1.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</UserControl.Resources>
<Grid x:Name="Layout">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"></RowDefinition>
        <RowDefinition Height="*"></RowDefinition>
        <RowDefinition Height="Auto"></RowDefinition>
    </Grid.RowDefinitions>

    <telerik:RadRichTextBoxRibbonUI 
            ApplicationName="Test Rich Textbox" 
            DataContext="{Binding Path=Commands, ElementName=radRich}"
            Name="radRichTextBoxRibbonUI"
            BackstageClippingElement="{Binding ElementName=Layout}">
        <telerik:RadRichTextBoxRibbonUI.Backstage>
            <telerik:RadRibbonBackstage>
                <telerik:RadRibbonBackstageItem Header="New"
                                                    IsSelectable="False"
                                                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=NewDocumentCommand}"></telerik:RadRibbonBackstageItem>
                <telerik:RadRibbonBackstageItem Header="Open"
                                                    IsSelectable="False"
                                                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=OpenDocumentCommand}"></telerik:RadRibbonBackstageItem>
                <telerik:RadRibbonBackstageItem Header="Save"
                                                    IsSelectable="False"
                                                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=SaveCommand}"></telerik:RadRibbonBackstageItem>
                <telerik:RadRibbonBackstageItem Header="Save As"
                                                    IsDefault="False">
                    <StackPanel HorizontalAlignment="Stretch" Margin="20,20,0,0">
                        <TextBlock Text="Save As"></TextBlock>
                        <Rectangle HorizontalAlignment="Left" Width="410"></Rectangle>
                        <StackPanel Margin="0,30,0,0" Orientation="Horizontal">
                            <telerik:RadRibbonButton BorderBrush="Gray"
                                                     CornerRadius="3"
                                                     Height="80"
                                                     Width="90"
                                                     CommandParameter="docx"                     
                                                     telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=SaveCommand}">
                                <StackPanel Width="90">
                                    <Image HorizontalAlignment="Center"></Image>
                                </StackPanel>
                            </telerik:RadRibbonButton>
                            <StackPanel Margin="20,0,0,0">
                                <TextBlock Text="Word Document"/>
                                <TextBlock Text="Save the file as a Word document." 
                                           TextWrapping="Wrap"
                                           Width="300"/>
                            </StackPanel>
                        </StackPanel>
                        <StackPanel Margin="0,30,0,0" Orientation="Horizontal">
                            <telerik:RadRibbonButton BorderBrush="Gray"
                                                     CornerRadius="3"
                                                     Height="80"
                                                     Width="90"
                                                     CommandParameter="pdf"                     
                                                     telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=SaveCommand}">
                                <StackPanel Width="90">
                                    <Image HorizontalAlignment="Center"></Image>
                                </StackPanel>
                            </telerik:RadRibbonButton>
                            <StackPanel Margin="20,0,0,0">
                                <TextBlock Text="Pdf Document"/>
                                <TextBlock Text="Save the file as a Pdf document." 
                                           TextWrapping="Wrap"
                                           Width="300"/>
                            </StackPanel>
                        </StackPanel>
                        <StackPanel Margin="0,30,0,0" Orientation="Horizontal">
                            <telerik:RadRibbonButton BorderBrush="Gray"
                                                     CornerRadius="3"
                                                     Height="80"
                                                     Width="90"
                                                     CommandParameter="xaml"                     
                                                     telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=SaveCommand}">
                                <StackPanel Width="90">
                                    <Image HorizontalAlignment="Center"></Image>
                                </StackPanel>
                            </telerik:RadRibbonButton>
                            <StackPanel Margin="20,0,0,0">
                                <TextBlock Text="Xaml Document"/>
                                <TextBlock Text="Save the file as a Xaml document." 
                                           TextWrapping="Wrap"
                                           Width="300"/>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </telerik:RadRibbonBackstageItem>
            </telerik:RadRibbonBackstage>
        </telerik:RadRichTextBoxRibbonUI.Backstage>
    </telerik:RadRichTextBoxRibbonUI>

    <telerik:RadRichTextBox x:Name="radRich" Grid.Row="1">
    </telerik:RadRichTextBox>
</Grid>

【问题讨论】:

    标签: wpf mvvm telerik


    【解决方案1】:

    这是我的错误,我没有将 Telerik 引用包含到 shell 项目中。

    【讨论】: