Universal Windows Platform (UWP)
A Microsoft platform for building and publishing apps for Windows desktop devices.
3,012 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Get Rect of Character in a Textblock.
I am able to get Rect of Controls using below Code....But I need Character Rect in a Textblock.
static Rect GetElementRect(FrameworkElement element)
{
GeneralTransform transform = element.TransformToVisual(null);
Point point = transform.TransformPoint(new Point());
return new Rect(point, new Size(element.ActualWidth, element.ActualHeight));
}
Textblock may contain same character Multiple Times.
var ClearButtonClicked= GetElementRect(ClearButton);
if (ClearButtonClicked.Contains(args.CurrentPoint.Position))
{
Text = String.Empty;
UpdateTextUI();
}