The problem I was having was that it would not honour the wrap inside the
container it was in. Instead of wrapping, the textbox would get wider and
wider as you typed and the container it was in would Autosize to the size
the textbox wanted to be. By setting maxwidth when the parent container is
resized it forces the textbox to wrap when it should.
Its most likely I'm using the wrong type of parent panel control type
(maybe?) but what I have is working to a point. It is currently resizing
larger but in some conditions it won't resize smaller.
I've left it for now and will come back to it when I've more time up my
sleeve.

Thanks for your reply, I'll check out the UpdateLayout too. I imagine I'd
need to hook up to a completed event for it to work properly (without any
possible race conditions)
cheers,
Stephen

On Mon, Sep 26, 2011 at 1:46 PM, Patrick Klug <[email protected]> wrote:

> Hi Stephen,
>
> You shouldn't have to set the MaxWidth manually. Setting TextWrapping="Wrap"
>  on your text box is all you should need to do.
>
> To your specific issue about ActualWidth not being up to date you would
> need to call Comment.UpdateLayout() after you invalidate the visual.
>
> cheers,
> Patrick
>
> On Thu, Sep 22, 2011 at 12:28 PM, Stephen Price 
> <[email protected]>wrote:
>
>> Hey all,
>>
>> I've got a TextBox in a DockPanel, basically takingup the remainder of the
>> Dock, being the right most field. I want the textbox to take up the
>> remainder of the panel (which it does nicely) and I also want it to wrap,
>> which it does.
>> The thing I'm having troubles with, is when I resize the dockpanel (the
>> whole thing is in a grid with a splitter, its in the left side with another
>> grid on the right). When I resize the DockPanel via the GridSplitter I need
>> to be able to alter the Width, or the MaxWidth so that it continues to wrap
>> as intended.
>>
>> I tried setting the MaxWidth to positive infinity and then back to the
>> ActualWidth but think its happening too quick so the ActualWidth hasnt been
>> recalculated yet.
>>
>>             Comment.MaxWidth = double.PositiveInfinity;
>>             Comment.InvalidateVisual();
>>             Comment.MaxWidth = Comment.ActualWidth;
>>
>>
>> Anyone got an idea on how I can make the Wrap work correctly inside the 
>> DockPanel for the Last child item?
>>
>> thanks,
>>
>> Stephen
>>
>> p.s. I think we should merge the OzSilverlight and OzWpf lists into a single 
>> OzXaml list.
>>
>>
>> _______________________________________________
>> ozwpf mailing list
>> [email protected]
>> http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf
>>
>>
>
> _______________________________________________
> ozwpf mailing list
> [email protected]
> http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf
>
>
_______________________________________________
ozwpf mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf

Reply via email to