I have TextBlock with some Text="AAAAAAAA", FontFamily="Arial", FontSize="16". How I can convert Text to WPF pixels?
You could use FormattedText
for measuring:
FormattedText formattedText = new FormattedText(
"AAAAAAAA",
CultureInfo.CurrentCulture,
FlowDirection.LeftToRight,
new Typeface("Arial"), 16, Brushes.Black
);
MessageBox.Show(formattedText.Width.ToString());