3.0.0.5 WP7 exception

Mar 28, 2010 at 10:20 PM

Hi,

thanks for the new version compatible with WP7. However, after I insert PhysicObjectBehavior into Ellipse element, this exception is showed in MsgBox in WP7 emulator after program start: 

 

Error 
Could not determine the outline of UIElement sprite_5. Could not find a point within its boundaries. 
at 
Spritehand.FarseerHelper.BoundaryHelper.GetPointsForPath(UIElement element, UIElement containerElement, Boolean positionOnly)

Error 

Could not determine the outline of UIElement sprite_5. Could not find a point within its boundaries. 

at 

Spritehand.FarseerHelper.BoundaryHelper.GetPointsForPath(UIElement element, UIElement containerElement, Boolean positionOnly)

 

Could you help me where coult be the problem? With rectangles it works without problems.

 

Coordinator
Mar 29, 2010 at 3:44 PM

Are you in Landscape mode?

I found that there are issues with VisualTreeHelper on WP7 when in Landscape mode, so Boundary detection and Collision detection are problematic if you are in Landscape mode. I have submitted this issue to the Silverlight/WP7 team but have not gotten any details on it yet.

 

Mar 29, 2010 at 6:44 PM

No, I am in portrait mode.

Coordinator
Mar 29, 2010 at 6:59 PM

Hmm... Should work then.

As a sanity check I just did a quick test and it seemed OK.

Can you post a small sample of XAML that has the issue (if you could cut it down as much as possible to simplify that would be best).

Mar 29, 2010 at 7:35 PM

I found the problem, after I removed the Grids and remained only Canvas, it works... Here is the original code:

 

<phoneNavigation:PhoneApplicationPage

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:phoneNavigation="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Navigation"

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:pb="clr-namespace:Spritehand.PhysicsBehaviors;assembly=Spritehand.PhysicsBehaviors"

x:Class="SkuskaFutbal2.MainPage"

mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"

FontFamily="{StaticResource PhoneFontFamilyNormal}"

FontSize="{StaticResource PhoneFontSizeNormal}"

Foreground="{StaticResource PhoneForegroundBrush}">

 

<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneBackgroundBrush}">

<Grid.RowDefinitions>

<RowDefinition Height="Auto"/>

<RowDefinition Height="*"/>

</Grid.RowDefinitions>

 

<!--TitleGrid is the name of the application and page title-->

<Grid x:Name="TitleGrid" Grid.Row="0">

<TextBlock Text="MY APPLICATION" x:Name="textBlockPageTitle" Style="{StaticResource PhoneTextPageTitle1Style}"/>

<TextBlock Text="page title" x:Name="textBlockListTitle" Style="{StaticResource PhoneTextPageTitle2Style}"/>

</Grid>

<Canvas x:Name="ContentGrid" Grid.Row="1">

<i:Interaction.Behaviors>

<pb:PhysicsControllerBehavior MousePickEnabled="True"/>

</i:Interaction.Behaviors>

<Rectangle Fill="#FF030A47" Height="16" Canvas.Left="8" Stroke="Black" Canvas.Top="612" Width="464">

<i:Interaction.Behaviors>

<pb:PhysicsObjectBehavior IsStatic="True"/>

</i:Interaction.Behaviors>

</Rectangle>

<Ellipse Fill="#FF030A47" Height="24" Canvas.Left="98" Stroke="Black" Canvas.Top="206" Width="23">

<i:Interaction.Behaviors>

<pb:PhysicsObjectBehavior />

</i:Interaction.Behaviors>

</Ellipse>

</Canvas>

 

</Grid>

 

</phoneNavigation:PhoneApplicationPage>

Mar 30, 2010 at 3:20 AM

I've found that if you use *any* type of offset from 0,0 with ellipses (e.g., Canvas.Left, Margin, placing the Canvas in a grid, placing the Canvas within another Canvas that has some type of offset) you see the "...could not find a point..." exception.  Seems like the hit test doesn't account for the offset(s). I'll try to convince one of our devs to take a look at the source.