.net 3.5 - WPF - How to right align a textblock inside a horizontally oriented stackpanel? -
It should be so easy - I try to keep my head against my desk for a simple simple task for so long I am working (I think WPF is informal or buggy) ...
In any case, I have got a stackpanel, which is set on horizontal orientation, I have got two text boxes inside it. I want the second one to display that text correctly.
How do I complete it?
All this reminds me of why I walked away from Silverlight:
If you do not want all the elements to be stacked like stacked, then you have to use a dockpanel to stackpackel right-align to cause another text block, to fill the area between them. You can add an extra dummy text block to:
& lt; DocPanel & gt; & Lt; TextBlock & gt; Left text & lt; / TextBlock & gt; & Lt; TextBlock DockPanel.Dock = "right" & gt; Correct Text & lt; / TextBlock & gt; & Lt; TextBlock / & gt; & Lt; / DockPanel & gt;
or you can use the TextAlignment attribute:
& lt; DocPanel & gt; & Lt; TextBlock & gt; Left text & lt; / TextBlock & gt; & Lt; TextBlock TextElement = "Right" & gt; Correct Text & lt; / TextBlock & gt; & Lt; / DockPanel & gt;
Comments
Post a Comment