silverlightlayoutsizetextblockinlineuicontainer

Set size of InlineUIContainer?


I wrapped a TextBlock in an InlineUIContainer inside a RichTextBox, its content is bound to an external multi-line TextBox that the user updates on the spot.

What happens is the InlineUIContainer's size doesn't expand or shrink as needed, it's a static size, I need it to be extended according to the size of the inner TextBlock (I've tested the size of the TextBlock and it does resize according to its content).

Any way to do this? Of course a XAMLy way is preferred, even more verbose.


Solution

  • I did an ugly and hacky workaround, hope to be able to replace it soon.

    I made another property in the ViewModel, that returns:

    string.IsNullOrWhitespace(comments) ? 
      string.Empty : 
      string.Format("Comments:{1}{0}{1}", comments, Environment.NewLine);  
    

    It works but is nasty.