日期:2014-05-17  浏览次数:21144 次

|ZYCWPF| 为RichTextBox添加查找替换功能,为什么我绑定的控件得不到控件对像,而是得到一个int 0 谢谢
原贴:http://bbs.csdn.net/topics/390319147
XAML改为:


<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 AncestorType={x:Type zc:ZRichTextBox}}}" 
                                   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.Inpu