本帖最后由 javamy009 于 2012-12-17 15:36:13 编辑

解决方案 »

  1.   

    我这里试了可以同时绑定,Ctrl-F, Ctrl-H, F3都没问题。
    只是你后台没有写ReplaceBinding,要补一个: public CommandBinding ReplaceBinding
    {
    get
    {
    return new CommandBinding(ApplicationCommands.Replace, (s, e) => ShowAsReplace());
    }
    }
    在resouce中的绑定要和饿了ment在同一个visual tree中,你可以把这些资源都移到richtextbox下面:<Window x:Class="_0_0_测试.MainTest"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:zc="clr-namespace:Z.Core.WPF.Controls;assembly=Z.Core.WPF"
            xmlns:local="clr-namespace:_0_0_测试"
            Title="MainTest" Height="600" Width="600">
        <StackPanel>
            <Button Content="选择内容" Click="Button_Click_1" />
            <zc:ZRichTextBox x:Name="richTextBox"
                             Height="200" Margin="10,10,10,5" 
                             ToolbarBackground="#FFD2CB84" ToolbarBorderBrush="#FFC6BE75" ToolbarBorderThickness="1,1,1,0" 
                             CodeControlsVisibility="Visible" >
                <zc:ZRichTextBox.Resources>
                    <zc:IEditorConverter x:Key="IEditorConverter" />
                    <zc:FindReplaceMgr x:Key="FRep"
                                       InterfaceConverter="{StaticResource IEditorConverter}" 
                                       CurrentEditor="{Binding RelativeSource={RelativeSource Self} }" 
                                       AllowReplace="True" />
                </zc:ZRichTextBox.Resources>
                <zc:ZRichTextBox.CommandBindings>
                    <local:StaticResourceEx ResourceKey="FRep" Path="FindBinding" />
                    <local:StaticResourceEx ResourceKey="FRep" Path="ReplaceBinding" />
                    <local:StaticResourceEx ResourceKey="FRep" Path="FindNextBinding" />
                </zc:ZRichTextBox.CommandBindings>
                <zc:ZRichTextBox.InputBindings>
                    <KeyBinding Key="F3" Modifiers="Shift" Command="Search" CommandParameter="something" />
                </zc:ZRichTextBox.InputBindings>
            </zc:ZRichTextBox>
        </StackPanel>
    </Window>
    然后code behinde要调整下