Ball inside the pocket hole. WPF <p>My Code is giving me a NaN value when I tried to test its return value. the code is here C#:</p> <pre><code>var hx1 = Canvas.GetLeft(top); var hy1 = Canvas.GetTop(top); Rect h1 = new Rect(hx1, hy1, top.ActualWidth, top.ActualHeight); Console.WriteLine(h1); </code></pre> <p>XAML</p> <pre><code>&lt;Canvas Canvas.Left="134" Canvas.Top="98" Height="500" Width="1010"&gt; &lt;Ellipse Height="50" Name="top" Stroke="Black" Width="50" Margin="481,4,479,446" /&gt; &lt;Ellipse Height="50" Margin="30,21,930,429" Name="topLeft" Stroke="Black" Width="50" /&gt; &lt;Ellipse Height="50" Margin="30,430,930,20" Name="botLeft" Stroke="Black" Width="50" /&gt; &lt;Ellipse Height="50" Margin="481,444,479,6" Name="bot" Stroke="Black" Width="50" /&gt; &lt;Ellipse Height="50" Margin="930,430,30,20" Name="botRight" Stroke="Black" Width="50" /&gt; &lt;Ellipse Height="50" Margin="930,21,30,429" Name="topRight" Stroke="Black" Width="50" /&gt; &lt;Grid Canvas.Left="0" Canvas.Top="0" Height="500" Width="1010"&gt; &lt;!--&lt;Canvas Height="500" Width="1010" Name="PoolCanvas"&gt;--&gt; &lt;ContentControl x:Name="poolContainer"&gt; &lt;/ContentControl&gt; &lt;!--&lt;/Canvas&gt;--&gt; &lt;/Grid&gt; &lt;/Canvas&gt; </code></pre> <p>First of all, I am trying to make a pool game using WPF. Right now I am trying to make a 'pocket hole' for the ball to go in inside the pool. I was told about retrieving the holes x and y first or coordinates of the holes and later check the intersection and do the coding of balls putting it inside the pocket. However on my code, its only giving me this output: NaN,NaN,50,50 when I tried to print that rect.</p> <p>One more thing, If there is another type of method where I can fulfill these goals where if ball go inside the pocket hole. ball will disappear. If you think I still need to give more code. Feel free to comment. I am open for suggestions. Thank you in advance and sorry if I have grammar errors.</p>