So I have this XAML in the .xaml file
<StackPanel>
<Button Width="200" Height="30" Content="Change Words"
Click="Button_Click"/>
<FlowDocumentReader
ViewingMode="Scroll" Zoom="90"
Focusable="True"
Background="White"
IsFindEnabled="True"
IsPageViewEnabled="True"
IsScrollViewEnabled="True"
x:Name="FDR"
Document="{Binding Path=WordDocument}"
Width="400" Height="400">
</FlowDocumentReader>
</StackPanel>
And in the code behind, On load,
public partial class Window1 : Window
{
MyDoc _myDoc = null;
FlowDocument _theFlowDocument;
public Window1()
{
InitializeComponent();
_myDoc = new MyDoc().Create(); // Create returns MyDoc, that has a WordDocument property with some FlowDocument contents
this.DataContext = _myDoc ;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
_myDoc.WordDocument = _myDoc.CreateFlowDocument("Now it's changed");
}
}
On button click, I am changing the contents of the WordDocument. The CreateFlowDocument creates a Paragraph and a Run with the string passed.
When button is clicked, the FlowDocumentReader doesn't show the changed contents, although I've bound it to the WordDocument property
What am I doing wrong?