How to set a RichTextBox in Silverlight 4 to fit it's parent height and maintain it on resize?

Posted by Ivan Zlatanov on Stack Overflow See other posts from Stack Overflow or by Ivan Zlatanov
Published on 2010-05-25T21:23:49Z Indexed on 2010/05/26 7:11 UTC
Read the original article Hit count: 500

I am having hard times figuring this out. Here is what I need:

<StackPanel x:Name="container" VerticalAlignment="Stretch">
     <RichTextBox Height="???" />
</StackPanel>

Basically what I know I can do is to bind RichTextBox Height to it's parent's height ( Height="{Binding ElementName=container, Path=ActualHeight}". Unfortunately this only works on load, because as it seems ActualHeight and ActualWidth don't notify for changes.

So what is the best way in Silverlight 4 to tell RichTextBox or TextBlock, it doesn't matter, to fill it's parent height, and maintain scrollbar if it's content height is bigger. Is the only way to bind some Resize events and maintain the height explicitly? That seems really ugly to me?

© Stack Overflow or respective owner

Related posts about richtextbox

Related posts about resizing