i need to set height of UiElement based on the content . i set content to a text block and set text block MaxWidth is some value and MaxHeight is double.MaxValue. now i set this textblock to child of border.nowi measure the border like below

```
textBlock.MaxWidth=200;
textBlock.MaxHeight=double.MaxValue;
var area=new Border{child=textBlock};
area.Measure(new size(textBlock.MaxWidth,textBlock.MaxHeight));
var r=area.DesiredSize;

```

but above code give the incorrect desiredsize for different width of text block. is there any other way to calculate the height based on text content.