Alex Rivera | Logout

how to calculate the textbock height and width in on load if i create textblock from code?

Asked 2012-05-11T17:32:19.303
9
TextBlock tbl= new TextBlock();
tbl.text="Kishore";

double x=tbl.ActualHeight;
double y=tbl.ActualWidth;

If i execute the code from the loaded event in Metro - winRT will return 0 for both.

How can I get the ActualWidth in the Loaded or SizeChanged event?

Edit
Report

1 Answer

10

Call Measure() then Arrange() and then ActualWidth and ActualHeight will be updated.

answered 2012-05-12T02:14:16.560

Your Answer