There are so many question here where users say 'hey, this doesn't work', when really, all they need to do is look at their code. You gave us some code (which you really should have added to your question for clarity):
<TextBlock Text="test" HorizontalAlignment="Left" VerticalAlignment="Center"
Name="lblUserName" FontSize="16" />
If, instead of coming to this site, creating a new user and asking a question, you had simply put your own code into a new project or Window
, then you would see that it works just fine... try it now. :)
As such, like @devhedgehog said, you must have something else in your code that is cutting off the end of your TextBlock
. A good way to find the offending element is set the Background
properties of your various controls:
<TextBlock Text="test" HorizontalAlignment="Left" VerticalAlignment="Center"
Name="lblUserName" FontSize="16" Background="Red" />
Using this, it should be clear that the TextBlock
has been cut off. If you set this property on the other controls on your page then you should eventually find the one that is covering or restricting the size of your TextBlock
.
It could also be getting cut off by a containing Grid Column
or StackPanel
if you have not set the Width
correctly.