具有动态内容的FlowDocument(BlockUIContainer)

时间:2010-01-29 11:06:38

标签: xaml flowdocumentscrollviewer

我在记事本中写了简单的xaml文件:

<FlowDocument AllowDrop="True" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"><Paragraph /> <BlockUIContainer><Button Tag="another.xaml">Next...</Button> </BlockUIContainer></FlowDocument>

此文件包含BlockUIContainer,其中包含Button。 Button还具有Tag-property,其中包含对另一个xaml文件的引用。 当我将我的xaml文件加载到FlowDocumentScrollViewer时,我想单击该按钮并在同一个FlowDocumentScrollViewer中加载another.xaml。我怎样才能做到这一点?我怀疑我需要搜索我的按钮,但我不知道如何。

1 个答案:

答案 0 :(得分:0)

如果将ContentControl添加到XAML文档,则可以在内容中插入另一个控件。您可以将ContentControl的Content属性绑定到another.xaml并将ContentControl设置为默认隐藏,然后使其在Button OnClick事件处理程序中可见,或者您可以始终使ContentControl可见并仅设置其内容Button OnClick事件处理程序中的属性。