I have a WPF windown in which I have a FlowDocumentScrollViewer, and a FlowDocument as its child. Inside the FlowDocument element, of course, I have grids, textboxes and such, and they all work fine, but whenever I click on them, the scroll bar is scrolled all the way down. The code is as such:
<FlowDocumentScrollViewer Grid.Row="1" Grid.Column="1">
<FlowDocument x:Name="flowDoc" PagePadding="0">
<Section>
<BlockUIContainer>
<Border BorderBrush="Red" BorderThickness="2">
<Grid x:Name="masterGrid" Height="1500">
<!--window structure here-->
</Grid>
</Border>
</BlockUIContainer>
</Section>
</FlowDocument>
</FlowDocumentScrollViewer>
This behavior is not desired, but I also have no idea as to what is causing it. How do I prevent it from happening?
Well, not adressing the cause (which is still unclear) but rather the problem itself, I managed to get it to stop scrolling all the way down by removing FlowDocument
and Section
, and switching FlowDocumentScrollViewer
by ScrollViewer
. For my needs, that was possible and enough.