xyzzer / WinRTXamlToolkit

WinRT XAML Toolkit
Other
282 stars 67 forks source link

TextBlockExtensions GetCharacterRect always return rect(0,0,0,0) #25

Open LSongBee opened 8 years ago

LSongBee commented 8 years ago

I try to use the TextBlockExtensions GetCharacterRect function to get text character's position and size but this function always return rect(0,0,0,0). This issue is only at UWP platform, I try the same extension at win 8.1, it is OK.

xyzzer commented 8 years ago

Seems to be working fine in the CascadingTextBlock control, I think. Could you provide repro steps?

LSongBee commented 8 years ago

I'm not try CascadingTextBlock control I directly use TextBlockExtensions's GetCharacterRect at default TextBlock element. I just drag a TextBlock in xaml page, name it "tbTest", assing Text="Hello world". And call tbTest.GetCharacterRect(x) in .cs program to get every characters' rectangle. It return rect(0,0,0,0) at every char's position. But, do the same thing at win 8.1. It can correctly return the chars' rectangle.

xyzzer commented 8 years ago

I'll check it out when I get a chance. I remember that code wasn't really exact science. Maybe CascadingTextBlock doesn't actually need it or uses it in some very specific conditions.