Solved! Go to Solution.
<Path x:Name="BorderPath" StrokeLineJoin="Round" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding StrokeThickness}" />
<Style TargetType="esri:InfoWindow"> <Setter Property="Background" Value="White" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="VerticalAlignment" Value="Top" /> <Setter Property="Padding" Value="0" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="esri:InfoWindow"> <Grid x:Name="Root" RenderTransformOrigin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=RenderTransformOrigin}"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Show"> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" Storyboard.TargetName="Root"> <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1"> <EasingDoubleKeyFrame.EasingFunction> <BackEase EasingMode="EaseOut" Amplitude=".5"/> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" Storyboard.TargetName="Root"> <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1"> <EasingDoubleKeyFrame.EasingFunction> <BackEase EasingMode="EaseOut" Amplitude=".5"/> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> </DoubleAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="Hide"> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" Storyboard.TargetName="Root"> <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="0"> <EasingDoubleKeyFrame.EasingFunction> <CircleEase EasingMode="EaseIn" /> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" Storyboard.TargetName="Root"> <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="0"> <EasingDoubleKeyFrame.EasingFunction> <CircleEase EasingMode="EaseIn" /> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> </DoubleAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid.RenderTransform> <ScaleTransform ScaleX="0" ScaleY="0" /> </Grid.RenderTransform> <Path x:Name="BorderPath" StrokeLineJoin="Round" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding StrokeThickness}" Opacity="0" /> <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Margin="{TemplateBinding Margin}" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
<DataTemplate x:Key="MyFeatureLayerInfoWindowTemplate"> <Grid Background="Blue" Width="100" Height="20" Margin="0,0,0,-10"> <TextBlock Text="{Binding Attributes[Number]}" Foreground="White" FontSize="12" HorizontalAlignment="Center" VerticalAlignment="Center" /> </Grid> </DataTemplate>
<esri:InfoWindow x:Name="MyInfoWindow" Padding="0" CornerRadius="0" Map="{Binding ElementName=_map}" ContentTemplate="{StaticResource MyFeatureLayerInfoWindowTemplate}" />
private void OpenOnMouseClick(object sender, Map.MouseEventArgs e) { var layer = _map.Layers["Graphics"] as GraphicsLayer; var graphics = layer.FindGraphicsInHostCoordinates(e.ScreenPoint); if (graphics.Count() == 1) { var graphic = graphics.ToList()[0]; MyInfoWindow.Anchor = graphic.Geometry as MapPoint; MyInfoWindow.IsOpen = true; MyInfoWindow.Content = graphic; } }
<Path x:Name="BorderPath" StrokeLineJoin="Round" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding StrokeThickness}" />
<Style TargetType="esri:InfoWindow"> <Setter Property="Background" Value="White" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="VerticalAlignment" Value="Top" /> <Setter Property="Padding" Value="0" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="esri:InfoWindow"> <Grid x:Name="Root" RenderTransformOrigin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=RenderTransformOrigin}"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Show"> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" Storyboard.TargetName="Root"> <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1"> <EasingDoubleKeyFrame.EasingFunction> <BackEase EasingMode="EaseOut" Amplitude=".5"/> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" Storyboard.TargetName="Root"> <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1"> <EasingDoubleKeyFrame.EasingFunction> <BackEase EasingMode="EaseOut" Amplitude=".5"/> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> </DoubleAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="Hide"> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" Storyboard.TargetName="Root"> <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="0"> <EasingDoubleKeyFrame.EasingFunction> <CircleEase EasingMode="EaseIn" /> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" Storyboard.TargetName="Root"> <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="0"> <EasingDoubleKeyFrame.EasingFunction> <CircleEase EasingMode="EaseIn" /> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> </DoubleAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid.RenderTransform> <ScaleTransform ScaleX="0" ScaleY="0" /> </Grid.RenderTransform> <Path x:Name="BorderPath" StrokeLineJoin="Round" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding StrokeThickness}" Opacity="0" /> <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Margin="{TemplateBinding Margin}" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
<DataTemplate x:Key="MyFeatureLayerInfoWindowTemplate"> <Grid Background="Blue" Width="100" Height="20" Margin="0,0,0,-10"> <TextBlock Text="{Binding Attributes[Number]}" Foreground="White" FontSize="12" HorizontalAlignment="Center" VerticalAlignment="Center" /> </Grid> </DataTemplate>
<esri:InfoWindow x:Name="MyInfoWindow" Padding="0" CornerRadius="0" Map="{Binding ElementName=_map}" ContentTemplate="{StaticResource MyFeatureLayerInfoWindowTemplate}" />
private void OpenOnMouseClick(object sender, Map.MouseEventArgs e) { var layer = _map.Layers["Graphics"] as GraphicsLayer; var graphics = layer.FindGraphicsInHostCoordinates(e.ScreenPoint); if (graphics.Count() == 1) { var graphic = graphics.ToList()[0]; MyInfoWindow.Anchor = graphic.Geometry as MapPoint; MyInfoWindow.IsOpen = true; MyInfoWindow.Content = graphic; } }