[英]How to bind the Document property to FlowDocumentScrollViewer from code behind?
我如何將Document屬性綁定到FlowDocumentScrollViewer,如XAML中所示:
<FlowDocumentScrollViewer Document="{Binding ElementName=Element, Path=Text, Converter={StaticResource TextToFlowDocumentConverter}}"/>
但是在后面的代碼中?
我不確定這是否可以完全解決您要嘗試執行的操作,但是如果您在XAML中為FlowDocumentScrollViewer
命名,如下所示:
<FlowDocumentScrollViewer Name="FlowDocViewer" />
您可以在后面的代碼中設置Document
屬性。
像這樣:
public MyWindow() // constructor, in case this is confusing
{
InitializeComponent();
FlowDocViewer.Document = SomeDocumentObject;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.