The code below is working nice but the vertical ScrollBar
is disabled even if large text inside of TextBlock
. How can I enable it?
<UserControl.DataContext>
<viewModels:CommentsViewModel/>
</UserControl.DataContext>
<Grid>
<DockPanel >
<TreeView DockPanel.Dock="Top"/>
<Expander Header="Yo" DockPanel.Dock="Bottom" VerticalAlignment="Bottom">
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
<TextBlock TextWrapping="Wrap" MaxHeight="250"
Text="{Binding Article.Article.Content}"/>
</ScrollViewer>
</Expander>
</DockPanel>
</Grid>
I found.
MaxHeight="250"
tag should be not in the TextBlock
, but should be in the Grid
to limit height. Then it will be working perfectly.
<UserControl.DataContext>
<viewModels:CommentsViewModel/>
</UserControl.DataContext>
<Grid>
<DockPanel >
<TreeView DockPanel.Dock="Top"/>
<Expander Header="Yo" DockPanel.Dock="Bottom" VerticalAlignment="Bottom">
<Grid MaxHeight="250">
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
<TextBlock TextWrapping="Wrap"
Text="{Binding Article.Article.Content}"/>
</ScrollViewer>
</Grid>
</Expander>
</DockPanel>
</Grid>