WPF, how to autosize control?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top