WPF, how to autosize control?

  • Thread starter Thread starter Poly
  • Start date Start date
P

Poly

I have Controle like this
<UserControl x:Class="OpticGraph.ObjectTip"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<Rectangle Stroke="Black" RadiusX="17" RadiusY="17" Fill="Pink" />
<TextBlock Name="textBlock" Margin="10,10,10,10"
Text="ObjectName" />
</Grid>
</UserControl>

In Visual studio disigner when I changed text of TextBlock all of it
resized.
I want to place this control on Canvas, but after Initiolazint this
control and text in it I have NaN in Width and Height, and I can't
detect center of it and place it.
How I can detect it's sizes, or handle it, to place with correct sizes
on Canvas?

___________
best regards
Poly
 
Back
Top