FlowDocument with dynamic content (BlockUIContainer)
I write simple x开发者_如何学Goaml-file in notepad:
<FlowDocument AllowDrop="True"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"><Paragraph />
<BlockUIContainer><Button Tag="another.xaml">Next...</Button>
</BlockUIContainer></FlowDocument>
This file contains BlockUIContainer with Button inside. Button also has Tag-property which contains reference to another xaml-file. When I load my xaml-file to FlowDocumentScrollViewer I want to click the button and load another.xaml in same FlowDocumentScrollViewer. How can I do this? I suspect that I need to search my button, but I don't know how.
If you add a ContentControl to your XAML document, you can insert another control into the content. You can either bind the Content property of the ContentControl to another.xaml and set the ContentControl to be hidden by default, then make it visible in the Button OnClick event handler, or you can have the ContentControl visible all the time and just set its Content property in your Button OnClick event handler.
精彩评论