Text align
Why do WPF and Noesis align text differently (left WPF, right Noesis)?
I guess it makes it difficult to develop with Blend but I am not sure, maybe I am doing something wrong - I am new to XAML/Noesis/WPF.
I guess it makes it difficult to develop with Blend but I am not sure, maybe I am doing something wrong - I am new to XAML/Noesis/WPF.
Re: Text align
how you align text, as text, or whole textBlock / label in to button grid?
Try in Blend set all align changes in to local (click on the rectangle button nex to align settings and set Change in to Local) then export your xaml in to noesis.
Try in Blend set all align changes in to local (click on the rectangle button nex to align settings and set Change in to Local) then export your xaml in to noesis.
Re: Text align
Yes, I am applying VerticalAlignment="Center" to TextBlock. Sadly, your solution didn't help but thanks! Its not centered in Blend and in Noesis XamlPlayer. I could play with different padding/margin settings but the fact that Blend/WPF and Noesis center the text differently just stops me from doing that... Any tips?
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: Text align
Could you please create a ticket in our bugtracker and share the .ttf/.otf file that is not correctly centered?
We rely on truetype default metric tables to calculate font's height, maybe that font does not provide these metrics in a standard way.
We rely on truetype default metric tables to calculate font's height, maybe that font does not provide these metrics in a standard way.
Re: Text align
Please, if you can, also attach a small XAML with the problem. Thanks!
Re: Text align
When I click on bug tracker it asks me my nick and pass. After I enter them it tells me I am either blocked or my info is incorrect.
So I am going to post the small code sample here. Also, the font can be downloaded from here: https://www.dafont.com/headliner-no-45.font
So I am going to post the small code sample here. Also, the font can be downloaded from here: https://www.dafont.com/headliner-no-45.font
Code: Select all
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008">
<Grid Background="Black">
<Border Width="300" Height="40" Background="White" Padding="0">
<TextBlock FontFamily="Fonts/#Headliner No. 45" TextAlignment="Center" FontSize="34" VerticalAlignment="Center" Foreground="Black">
This is a test
</TextBlock>
</Border>
</Grid>
</Page>
Re: Text align
You need to create a new account for the tracker (can be same user and passwd if you want). Please, upload the issue there, it is easier to track there. Thanks!When I click on bug tracker it asks me my nick and pass. After I enter them it tells me I am either blocked or my info is incorrect.
Re: Text align
I have same bug with ContentPresenter inside comboBox. The text is different align (similar to picture posted in first post) when I use ContentPresenter inside button and have Horizontal and Vertical Aligmment set to stretch.
But I found workaround, if ContentPresenter have Vertical Aligmment set to Center, then it is working as expected.
Btw. I use basic font from Noesis (Roboto).
But I found workaround, if ContentPresenter have Vertical Aligmment set to Center, then it is working as expected.
Btw. I use basic font from Noesis (Roboto).
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: Text align
In your case what you see is normal, is not the same issue. HorizontalAlignment/VerticalAligment Stretch option will make the ContentPresenter fill all the available space in the Button. And a TextBlock starts to render its text on the top left corner of its available space.I have same bug with ContentPresenter inside comboBox. The text is different align (similar to picture posted in first post) when I use ContentPresenter inside button and have Horizontal and Vertical Aligmment set to stretch.
But I found workaround, if ContentPresenter have Vertical Aligmment set to Center, then it is working as expected.
Btw. I use basic font from Noesis (Roboto).
If you want text inside a Button to be centered, you need to set ContentPresenter's HorizontalAlignment/VerticalAlignment to Center in Button's template.
Who is online
Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 59 guests