通过


RichTextBox.IsDocumentEnabled 属性

定义

获取或设置一个值,该值指示用户是否可以与UIElementContentElementRichTextBox的对象进行交互。

public:
 property bool IsDocumentEnabled { bool get(); void set(bool value); };
public bool IsDocumentEnabled { get; set; }
member this.IsDocumentEnabled : bool with get, set
Public Property IsDocumentEnabled As Boolean

属性值

如果用户可以与 <a0/&a0> 中的对象交互,则为 ;。

示例

以下示例创建CheckBox并包含 a Hyperlink 和 a ButtonRichTextBox . 该 IsDocumentEnabled 属性 RichTextBox 绑定到 IsChecked 该属性的属性 CheckBox。 当用户选择CheckBox时,用户可以与 and Hyperlink交互Button。 当用户清除时 CheckBox,将 Button 禁用和 Hyperlink 禁用。

<StackPanel>
    <CheckBox Name="IsDocumentEnabledChbk" Content="IsDocumentEnabled"/>
    <RichTextBox Name="richTB"
                 IsDocumentEnabled="{Binding ElementName=IsDocumentEnabledChbk,
                                             Path=IsChecked}">
        <FlowDocument>
            <Paragraph>
                Use the Checkbox above to switch between enabling and
                disabling the Button and Hyperlink in the RichTextBox.
                <Hyperlink>Here is a hyperlink</Hyperlink>
            </Paragraph>
            <BlockUIContainer>
                <Button>Click me!</Button>
            </BlockUIContainer>

        </FlowDocument>
    </RichTextBox>
</StackPanel>

注解

IsDocumentEnabled 在 .NET Framework 版本 3.5 中引入。 有关详细信息,请参阅 版本和依赖项

适用于