I am essentially creating a basic address bar for a component in my UI. The text in the TextBlock (inside a border) grows as you navigate a simple system.
I can get the text on the right to appear all the time by setting HorizontalAlignment=”Right” but if it doesn’t fill up the box then it looks weird because its right aligned. Is there any way to make it so that the right most text will appear but the text ends up left aligned?
I tried HorizontalAlignment=”Left” with TextAlignment=”Right”, didn’t work.
Here is some code so just so you can see the scenario
<Border CornerRadius="3" BorderThickness="1" BorderBrush="Gray" Margin="0,5,3,0" Padding="4,0,4,0" HorizontalAlignment="Stretch" Width="403" >
<TextBlock Text="This is a test/testynessssssss/goasdasdsaddddddddddddddddddddddddddddddddddddd" VerticalAlignment="Center" FontSize="12" HorizontalAlignment="Left" TextAlignment="Right" />
</Border>
The only thing I can think of it to wrap it in a
ScrollViewerwith invisible scrollbars, then have an attached property or something to auto scroll theScrollViewerto the right.Either that or write your own
Panel. This would probably be more useful in the long run.