Select to view content in your preferred language

DataStateBehavior causing stackoverflow

522
0
08-28-2012 05:36 AM
PetteriLehtonen
New Contributor
Hi,

I'm trying to use DataStateBehavior (from Blend) to control gow my MarkerSymbols behave:

Example (When setting GeoCodingDone = true on the ViewModel) i would like this pin to drop 50px and make it visible. This worked like this with Bing maps control and works immediately when i remove the DataStateBehavior. With the Behavior in place mscorlib causes stackoverflow error.

<esri:MarkerSymbol x:Key="MapPinSymbol">
         <esri:MarkerSymbol.ControlTemplate>
             <ControlTemplate>
                 <Grid ToolTipService.ToolTip="{Binding Attributes[DataContext].ServiceOrder.CustomerName}">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseLeftButtonDown">
                                <ei:ChangePropertyAction TargetObject="{Binding DataSource, Source={StaticResource DataContextProxy}}" PropertyName="SelectedServiceOrder" Value="{Binding Attributes[DataContext].ServiceOrder}"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                        <i:Interaction.Behaviors>
                            <ei:DataStateBehavior Binding="{Binding Attributes[DataContext].ServiceOrder.GeoCodingDone}" TrueState="GeoCodingDone" Value="true"/>
                        </i:Interaction.Behaviors>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="VisualStateGroup">
                                <VisualState x:Name="GeoCodingDone">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="PinGrid">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="PinGrid">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="PinGrid">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="-50"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0">
                                                <EasingDoubleKeyFrame.EasingFunction>
                                                    <PowerEase EasingMode="EaseInOut" Power="3"/>
                                                </EasingDoubleKeyFrame.EasingFunction>
                                            </EasingDoubleKeyFrame>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid x:Name="PinGrid"
     Width="26" Height="26" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-7,-23,0,0"
     Visibility="Collapsed" Opacity="0" RenderTransformOrigin="0.5,0.5" Cursor="Hand">
                            <Grid.RenderTransform>
                                <CompositeTransform TranslateY="-50"/>
                            </Grid.RenderTransform>
                            <Ellipse x:Name="downshadow" Fill="Black"/>

                            </Grid>
             </ControlTemplate>
         </esri:MarkerSymbol.ControlTemplate>
     </esri:MarkerSymbol>


Mapcontrol itself if it has any info:

<esri:Map Background="White" Margin="0" Name="map1" WrapAround="True" >
                <esri:Map.Layers>   
                 <esri:LayerCollection>
                  <esri:ArcGISTiledMapServiceLayer ID="TopoMapLayer"
                      Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />  

      <esri:GraphicsLayer ID="MarkerLayer" x:Name="markerLayer" IsHitTestVisible="True" RendererTakesPrecedence="True">           
          
       <esri:GraphicsLayer.GraphicsSource>               
        <esri:PointDataSource ItemsSource="{Binding DataSource.ServiceOrderLocations, Source={StaticResource DataContextProxy}}"  XCoordinateBinding="{Binding ServiceOrderLocation.Longitude}" YCoordinateBinding="{Binding ServiceOrderLocation.Latitude}">
        </esri:PointDataSource>
       </esri:GraphicsLayer.GraphicsSource>           
          
       <esri:GraphicsLayer.Renderer>               
        <esri:SimpleRenderer Symbol="{StaticResource MapPinSymbol}" />           
       </esri:GraphicsLayer.Renderer>    
       </esri:GraphicsLayer>
      </esri:LayerCollection>    
                </esri:Map.Layers>
            </esri:Map>
0 Kudos
0 Replies