Issue With Determining UIElement Actual Size
Posted: 22 Jul 2016, 04:05
Hey, a simple problem I'm having is grabbing the actual size of a parent container. The child containers may have any number of randomly sized components. In VS this code just works. Is this a bug that exists / was fixed? If there is another way to get the size please let me know. I looked here but the info doesn't seem to help me.
viewtopic.php?f=3&t=537
PS: I've sent in my invoice number in order to get access to the newer noesis build in case this has been fixed since my old version.
XAML
Breakpointing reveals that the actual size is always zero even after its been drawn on the screen.
Code behind
viewtopic.php?f=3&t=537
PS: I've sent in my invoice number in order to get access to the newer noesis build in case this has been fixed since my old version.
XAML
Code: Select all
<Canvas Canvas.Left="0" Canvas.Top="200" x:Name="m_canvas_player1">
<Rectangle Fill="Blue" Width="50" Height="50"/>
<Rectangle Fill="Yellow" Width="5" Height="5" Canvas.Left="22.5" />
</Canvas>
Code behind
Code: Select all
float centerX = m_canvas_player1.GetActualWidth() / 2f;
float centerY = m_canvas_player1.GetActualHeight() / 2f;
m_canvas_player1.UpdateLayout();
Noesis.Size size = m_canvas_player1.GetRenderSize();