NavigationAction

  1 <UserControl
  2     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6     xmlns:esri="http://schemas.esri.com/arcgis/client/2009" 
  7     xmlns:esriBehaviors="clr-namespace:ESRI.ArcGIS.Client.Behaviors;assembly=ESRI.ArcGIS.Client.Behaviors"
  8     xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
  9     x:Class="NavigationAction.MainPage"
 10     mc:Ignorable="d"
 11     d:DesignHeight="300" d:DesignWidth="400">
 12 
 13     <Grid x:Name="LayoutRoot" Background="White">
 14         <Grid.Resources>
 15             <LinearGradientBrush x:Key="CommonGradient" StartPoint="0.5,0" EndPoint="0.5,1">
 16                 <GradientStop Offset="0" Color="#99919191"/>
 17                 <GradientStop Offset="0.25" Color="#aa919191"/>
 18                 <GradientStop Offset="0.75" Color="#cc919191"/>
 19             </LinearGradientBrush>
 20             <Style x:Key="CommonBorder" TargetType="Border">
 21                 <Setter Property="BorderBrush" Value="White" />
 22                 <Setter Property="BorderThickness" Value="1" />
 23                 <Setter Property="CornerRadius" Value="5" />
 24                 <Setter Property="Background" Value="{StaticResource CommonGradient}" />
 25                 <Setter Property="Opacity" Value="1" />
 26             </Style>
 27             <Style x:Key="MenuItem" TargetType="Button">
 28                 <Setter Property="Foreground" Value="White"/>
 29                 <Setter Property="HorizontalAlignment" Value="Left"/>
 30                 <Setter Property="VerticalAlignment" Value="Center"/>
 31                 <Setter Property="HorizontalContentAlignment" Value="Left"/>
 32                 <Setter Property="FontSize" Value="12" />
 33                 <Setter Property="Template">
 34                     <Setter.Value>
 35                         <ControlTemplate TargetType="Button">
 36                             <Grid>
 37                                 <VisualStateManager.VisualStateGroups>
 38                                     <VisualStateGroup x:Name="CommonStates">
 39                                         <VisualState x:Name="Normal">
 40                                             <Storyboard>
 41                                                 <DoubleAnimation To="0" FillBehavior="HoldEnd" 
 42                                                      Storyboard.TargetName="menuItemHighlight" 
 43                                                      Storyboard.TargetProperty="Opacity" 
 44                                                      Duration="0:0:0.3" />
 45                                             </Storyboard>
 46                                         </VisualState>
 47                                         <VisualState x:Name="MouseOver">
 48                                             <Storyboard>
 49                                                 <DoubleAnimation To="0.15" FillBehavior="HoldEnd" 
 50                                                      Storyboard.TargetName="menuItemHighlight" 
 51                                                      Storyboard.TargetProperty="Opacity" 
 52                                                      Duration="0:0:0.3" />
 53                                             </Storyboard>
 54                                         </VisualState>
 55                                     </VisualStateGroup>
 56                                 </VisualStateManager.VisualStateGroups>
 57                                 <Rectangle x:Name="menuItemHighlight" Fill="#FFFFFFFF" 
 58                                            Opacity="0" Margin="0" />
 59                                 <ContentPresenter                                    
 60                                     Content="{TemplateBinding Content}"
 61                                     ContentTemplate="{TemplateBinding ContentTemplate}"
 62                                     VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
 63                                     HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
 64                                     Margin="{TemplateBinding Padding}" />
 65                             </Grid>
 66                         </ControlTemplate>
 67                     </Setter.Value>
 68                 </Setter>
 69             </Style>
 70         </Grid.Resources>
 71 
 72         <esri:Map x:Name="MyMap" WrapAround="True" Extent="-15000000,2000000,-7000000,8000000">
 73             <esri:ArcGISTiledMapServiceLayer ID="MyBaseLayer" 
 74                 Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
 75         </esri:Map>
 76 
 77         <Grid HorizontalAlignment="Right" VerticalAlignment="Top" Width="Auto" Height="Auto" Margin="10" >
 78             <Border Style="{StaticResource CommonBorder}" Padding="10,3,10,3">
 79                 <Border.Effect>
 80                     <DropShadowEffect />
 81                 </Border.Effect>
 82                 <StackPanel>
 83                     <TextBlock Text="Navigation Actions" Foreground="White" FontSize="14" FontWeight="Bold" Margin="4" />
 84                     <Button Style="{StaticResource MenuItem}"                             
 85                             Content="Pan To"  >
 86                         <i:Interaction.Triggers>
 87                             <i:EventTrigger EventName="Click">
 88                                 <esri:PanToAction
 89                                     TargetName="MyMap">
 90                                     <esri:PanToAction.Geometry>
 91                                         <esri:MapPoint X="-12340000" Y="4340000" />
 92                                     </esri:PanToAction.Geometry>
 93                                 </esri:PanToAction>
 94                             </i:EventTrigger>
 95                         </i:Interaction.Triggers>
 96                     </Button>
 97                     <Button Style="{StaticResource MenuItem}" 
 98                             Content="Zoom To" >
 99                         <i:Interaction.Triggers>
100                             <i:EventTrigger EventName="Click">
101                                 <esri:ZoomToAction
102                                     TargetName="MyMap">
103                                     <esri:ZoomToAction.Geometry>
104                                         <esri:Envelope XMin="-14930991.170" YMin="3611744.037" XMax="-11348896.882" YMax="5340571.181" />
105                                     </esri:ZoomToAction.Geometry>
106                                 </esri:ZoomToAction>
107                             </i:EventTrigger>
108                         </i:Interaction.Triggers>
109                     </Button>
110                     <Button Style="{StaticResource MenuItem}" 
111                             Content="Zoom To Full Extent" >
112                         <i:Interaction.Triggers>
113                             <i:EventTrigger EventName="Click">
114                                 <esri:ZoomToFullExtentAction                                    
115                                     TargetName="MyMap" />
116                             </i:EventTrigger>
117                         </i:Interaction.Triggers>
118                     </Button>
119                 </StackPanel>
120             </Border>
121         </Grid>
122 
123 
124 
125     </Grid>
126 </UserControl>

 

posted @ 2013-09-15 23:25  文刀三石  阅读(864)  评论(0编辑  收藏  举报