ArcGis API FOR Silverlight 做了个导航工具~
原文 http://www.cnblogs.com/thinkaspx/archive/2012/08/08/2628214.html
转载请注明文章出处:http://www.cnblogs.com/thinkaspx
地图是读取的谷歌图层。。
主要是导航工具 做出来费劲呀。。
马上上代码

- namespace ZoomwayWebGis.Controls.Generic
- {
- [TemplatePart(Name = "PanLeft", Type = typeof(FrameworkElement))]
- [TemplatePart(Name = "PanRight", Type = typeof(FrameworkElement))]
- [TemplatePart(Name = "PanUp", Type = typeof(FrameworkElement))]
- [TemplatePart(Name = "PanDown", Type = typeof(FrameworkElement))]
- [TemplatePart(Name = "ZoomSlider", Type = typeof(Slider))]
- [TemplatePart(Name = "ZoomInButton", Type = typeof(Button))]
- [TemplatePart(Name = "ZoomOutButton", Type = typeof(Button))]
- [TemplatePart(Name = "InstanceMark", Type = typeof(Button))]
- public class MapNavigator : ContentControl
- {
- FrameworkElement PanLeft;
- FrameworkElement PanRight;
- FrameworkElement PanUp;
- FrameworkElement PanDown;
- Button ZoomInButton;
- Button ZoomOutButton;
- Slider ZoomSlider;
- private double _panFactor = 0.5;
- private const double MaxResolution = 23218.433769164774;
- private const double MinResolution = 0.59716428347743467;
- public MapNavigator()
- {
- this.DefaultStyleKey = typeof(MapNavigator);
- }
- public override void OnApplyTemplate()
- {
- base.OnApplyTemplate();
- PanLeft = GetTemplateChild("PanLeft") as FrameworkElement;
- PanRight = GetTemplateChild("PanRight") as FrameworkElement;
- PanUp = GetTemplateChild("PanUp") as FrameworkElement;
- PanDown = GetTemplateChild("PanDown") as FrameworkElement;
- ZoomSlider = GetTemplateChild("ZoomSlider") as Slider;
- ZoomInButton = GetTemplateChild("ZoomInButton") as Button;
- ZoomOutButton = GetTemplateChild("ZoomOutButton") as Button;
- enablePanElement(PanLeft);
- enablePanElement(PanRight);
- enablePanElement(PanUp);
- enablePanElement(PanDown);
- // Set control's flow direction to LTR to avoid flipping East and West keys:
- this.FlowDirection = System.Windows.FlowDirection.LeftToRight;
- if (ZoomSlider != null)
- {
- if (Map != null)
- {
- SetupZoom();
- }
- ZoomSlider.Minimum = ;
- ZoomSlider.Maximum = ;
- ZoomSlider.SmallChange = .;
- ZoomSlider.LargeChange = .;
- ZoomSlider.LostMouseCapture += ZoomSlider_LostMouseCapture;
- ZoomSlider.LostFocus += ZoomSlider_LostMouseCapture;
- }
- if (ZoomInButton != null)
- ZoomInButton.Click += ZoomInButton_Click;
- if (ZoomOutButton != null)
- ZoomOutButton.Click += ZoomOutButton_Click;
- bool isDesignMode = System.ComponentModel.DesignerProperties.GetIsInDesignMode(this);
- if (isDesignMode)
- mouseOver = isDesignMode;
- ChangeVisualState(false);
- }
- private void ZoomOutButton_Click(object sender, RoutedEventArgs e)
- {
- Map.Zoom( / Map.ZoomFactor);
- }
- private void ZoomInButton_Click(object sender, RoutedEventArgs e)
- {
- Map.Zoom(Map.ZoomFactor);
- }
- private void Map_ExtentChanged(object sender, ExtentEventArgs args)
- {
- if (!double.IsNaN(Map.Resolution) && ZoomSlider != null)
- ZoomSlider.Value = ResolutionToValue(Map.Resolution);
- }
- #region State management
- private bool mouseOver = false;
- protected override void OnMouseLeave(MouseEventArgs e)
- {
- mouseOver = false;
- if (!trackingRotation)
- ChangeVisualState(true);
- base.OnMouseLeave(e);
- }
- protected override void OnMouseEnter(MouseEventArgs e)
- {
- mouseOver = true;
- ChangeVisualState(true);
- base.OnMouseEnter(e);
- }
- private void ChangeVisualState(bool useTransitions)
- {
- if (mouseOver)
- {
- GoToState(useTransitions, "MouseOver");
- }
- else
- {
- GoToState(useTransitions, "Normal");
- }
- }
- private bool GoToState(bool useTransitions, string stateName)
- {
- return VisualStateManager.GoToState(this, stateName, useTransitions);
- }
- #endregion
- #region Rotation
- Point startMousePos;
- private double angle = ;
- private bool trackingRotation = false;
- private double GetAngle(Point a, Point b)
- {
- if (a == null || b == null) return ;
- return Math.Atan2((b.X - a.X), (a.Y - b.Y)) / Math.PI * ;
- }
- #endregion
- #region Zoom
- private void ZoomSlider_LostMouseCapture(object sender, EventArgs e)
- {
- Map.ZoomToResolution(ValueToResolution(ZoomSlider.Value));
- }
- #endregion
- private void enablePanElement(FrameworkElement element)
- {
- if (element == null) return;
- element.MouseLeave += panElement_MouseLeftButtonUp;
- element.MouseLeftButtonDown += panElement_MouseLeftButtonDown;
- element.MouseLeftButtonUp += panElement_MouseLeftButtonUp;
- }
- private void panElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- if (Map == null || sender == null) return;
- Envelope env = Map.Extent;
- if (env == null) return;
- double x = , y = ;
- MapPoint oldCenter = env.GetCenter();
- MapPoint newCenter = null;
- var height = env.Height * _panFactor;
- var width = env.Width * _panFactor;
- // if units are degrees (the default), limit or alter panning to the lat/lon limits
- if (sender == PanUp) // North
- {
- y = oldCenter.Y + height;
- newCenter = new MapPoint(oldCenter.X, y);
- }
- else if (sender == PanRight) // East
- {
- x = oldCenter.X + width;
- newCenter = new MapPoint(x, oldCenter.Y);
- }
- else if (sender == PanLeft) // West
- {
- x = oldCenter.X - width;
- newCenter = new MapPoint(x, oldCenter.Y);
- }
- else if (sender == PanDown) // South
- {
- y = oldCenter.Y - height;
- newCenter = new MapPoint(oldCenter.X, y);
- }
- if (newCenter != null)
- Map.PanTo(newCenter);
- }
- private void panElement_MouseLeftButtonUp(object sender, MouseEventArgs e)
- {
- if (Map == null) return;
- }
- private double ValueToResolution(double value)
- {
- double max = Math.Log10(MaxResolution);
- double min = Math.Log10(MinResolution);
- double resLog = ( - value) * (max - min) + min;
- return Math.Pow(, resLog);
- }
- private double ResolutionToValue(double resolution)
- {
- double max = Math.Log10(MaxResolution);
- double min = Math.Log10(MinResolution);
- double value = - ((Math.Log10(resolution) - min) / (max - min));
- return Math.Min(, Math.Max(value, )); //cap values between 0..1
- }
- public void SetupZoom()
- {
- if (ZoomSlider != null && Map != null)
- {
- if (!double.IsNaN(MinResolution) && !double.IsNaN(MaxResolution) &&
- MaxResolution != double.MaxValue &&
- MinResolution != double.Epsilon &&
- !double.IsNaN(Map.Resolution))
- {
- ZoomSlider.Value = ResolutionToValue(Map.Resolution);
- }
- }
- }
- #region Properties
- public static readonly DependencyProperty MapProperty = DependencyProperty.Register("Map", typeof(Map), typeof(MapNavigator), new PropertyMetadata(OnMapPropertyChanged));
- private static void OnMapPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- MapNavigator nav = d as MapNavigator;
- Map map = e.NewValue as Map;
- Map oldmap = e.OldValue as Map;
- if (oldmap != null)
- {
- oldmap.RotationChanged -= nav.Map_RotationChanged;
- oldmap.ExtentChanged -= nav.Map_ExtentChanged;
- oldmap.ExtentChanging -= nav.Map_ExtentChanged;
- if (oldmap.Layers != null)
- oldmap.Layers.LayersInitialized -= nav.Layers_LayersInitialized;
- }
- if (map != null)
- {
- map.RotationChanged += nav.Map_RotationChanged;
- map.ExtentChanged += nav.Map_ExtentChanged;
- map.ExtentChanging += nav.Map_ExtentChanged;
- if (map.Layers != null)
- map.Layers.LayersInitialized += nav.Layers_LayersInitialized;
- nav.SetupZoom();
- }
- }
- private void Layers_LayersInitialized(object sender, EventArgs args)
- {
- SetupZoom();
- }
- public Map Map
- {
- get { return GetValue(MapProperty) as Map; }
- set { SetValue(MapProperty, value); }
- }
- public Double PanFactor { get { return _panFactor; } set { _panFactor = value; } }
- private void Map_RotationChanged(object sender, DependencyPropertyChangedEventArgs e)
- {
- double value = (this.FlowDirection == System.Windows.FlowDirection.LeftToRight) ? (double)e.NewValue : -(double)e.NewValue;
- angle = (double)e.NewValue;
- }
- #endregion
- }


- <Style TargetType="nmap:MapNavigator">
- <Setter Property="Foreground" Value="White" />
- <Setter Property="Background" Value="#F0999988" />
- <Setter Property="BorderBrush" Value="Transparent"/>
- <Setter Property="BorderThickness" Value=""/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="nmap:MapNavigator">
- <Grid x:Name="NavigatorRootGrid" Background="Transparent" RenderTransformOrigin="0.5,0.5" Opacity="">
- <Grid.Resources>
- <RadialGradientBrush x:Key="CircleButtonGradientBrush" GradientOrigin="0.25,0.25">
- <GradientStop Offset="0.25" Color="#99CCCCCC"/>
- <GradientStop Offset="1.00" Color="#99000000"/>
- </RadialGradientBrush>
- <SolidColorBrush x:Key="HoverShineBrush" Color="#749dd2" />
- <DropShadowEffect x:Key="HoverShineEffect" Color="#749dd2" BlurRadius="" ShadowDepth="" />
- <LinearGradientBrush x:Key="ThumbGradientBrush" EndPoint="0.5,0.95" StartPoint="0.5,0.05">
- <GradientStop Color="#749dd2" Offset="" />
- <GradientStop Color="#749dd2" Offset="" />
- </LinearGradientBrush>
- <LinearGradientBrush x:Key="ThumbPressedBrush" EndPoint="0.5,0.95" StartPoint="0.5,0.05">
- <GradientStop Color="#99CCCCCC" Offset="" />
- <GradientStop Color="#99333333" Offset="" />
- </LinearGradientBrush>
- <!--Circle Button Style-->
- <Style TargetType="Button" x:Key="CircleButtonStyle" >
- <Setter Property="Background" Value="#F0CCCCCC" />
- <Setter Property="Foreground" Value="#FF000000" />
- <Setter Property="BorderBrush" Value="#F0333333" />
- <Setter Property="BorderThickness" Value="" />
- <Setter Property="Padding" Value=""/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" TargetType="Button">
- <Grid x:Name="ButtonRootGrid" Background="Transparent">
- <VisualStateManager.VisualStateGroups>
- <VisualStateGroup x:Name="CommonStates" >
- <VisualState x:Name="Normal" />
- <VisualState x:Name="MouseOver">
- <Storyboard>
- <DoubleAnimation Storyboard.TargetName="HoverShineShape" Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.1" />
- </Storyboard>
- </VisualState>
- <VisualState x:Name="Pressed" />
- <VisualState x:Name="Disabled">
- <Storyboard>
- <DoubleAnimation Storyboard.TargetName="DisabledMask" Storyboard.TargetProperty="Opacity" To="0.7" Duration="0:0:0.1" />
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- <Ellipse x:Name="BackgroundShape" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
- Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}"
- StrokeThickness="{TemplateBinding BorderThickness}"/>
- <Ellipse x:Name="HoverShineShape" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
- Fill="{StaticResource HoverShineBrush}" Stroke="#00FFFFFF" StrokeThickness=""
- Effect="{StaticResource HoverShineEffect}" Opacity="0.0" />
- <ContentPresenter x:Name="contentPresenter" Content="{TemplateBinding Content}"
- ContentTemplate="{TemplateBinding ContentTemplate}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" />
- <Ellipse x:Name="DisabledMask" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
- Fill="#F0999999" Stroke="#00FFFFFF" StrokeThickness="" Opacity="0.0" IsHitTestVisible="false"/>
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!-- Zoom Bar Thumb Style-->
- <Style TargetType="Thumb" x:Key="ZoomBarThumbStyle">
- <Setter Property="Background" Value="{StaticResource ThumbGradientBrush}" />
- <Setter Property="BorderThickness" Value="" />
- <Setter Property="IsTabStop" Value="False" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="Thumb">
- <Grid x:Name="ThumbRootGrid" Background="Transparent">
- <VisualStateManager.VisualStateGroups>
- <VisualStateGroup x:Name="CommonStates">
- <VisualStateGroup.Transitions>
- <VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver" />
- <VisualTransition GeneratedDuration="00:00:00.1" To="Pressed" />
- <VisualTransition From="Normal" GeneratedDuration="00:00:00.25" To="MouseOver" />
- <VisualTransition From="MouseOver" GeneratedDuration="00:00:00.25" To="Normal" />
- <VisualTransition From="MouseOver" GeneratedDuration="00:00:00.25" To="Pressed" />
- <VisualTransition From="Pressed" GeneratedDuration="00:00:00.25" To="MouseOver" />
- </VisualStateGroup.Transitions>
- <VisualState x:Name="Normal" />
- <VisualState x:Name="MouseOver">
- <Storyboard>
- <DoubleAnimation Storyboard.TargetName="HoverShineBorder" Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.1" />
- </Storyboard>
- </VisualState>
- <VisualState x:Name="Pressed">
- <Storyboard>
- <DoubleAnimation Storyboard.TargetName="PressedBorder" Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.1" />
- </Storyboard>
- </VisualState>
- <VisualState x:Name="Disabled">
- <Storyboard>
- <DoubleAnimation Storyboard.TargetName="DisabledBorder" Storyboard.TargetProperty="Opacity" To="0.5" Duration="0:0:0.1" />
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- <Border x:Name="BackgroundBorder" Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="" />
- <Border x:Name="HoverShineBorder" Background="{StaticResource HoverShineBrush}"
- BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="" Opacity="" />
- <Border x:Name="PressedBorder" Background="{StaticResource ThumbPressedBrush}"
- BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="" Opacity="" />
- <Border x:Name="DisabledBorder" Background="#F0999999" IsHitTestVisible="false" CornerRadius="" Opacity="" />
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!-- Zoom Slider Style-->
- <Style TargetType="Slider" x:Key="ZoomSliderStyle">
- <Setter Property="BorderThickness" Value="" />
- <Setter Property="BorderBrush" Value="#99666666" />
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="Foreground" Value="#99666666" />
- <Setter Property="IsTabStop" Value="False" />
- <Setter Property="Maximum" Value="" />
- <Setter Property="Minimum" Value="" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="Slider">
- <Grid x:Name="LayoutRoot" Background="Transparent">
- <Grid.Resources>
- <ControlTemplate x:Key="RepeatButtonTemplate1">
- <Grid x:Name="Root" Opacity="" Background="Transparent" />
- </ControlTemplate>
- <ControlTemplate x:Key="RepeatButtonTemplate2">
- <Grid x:Name="Root" Opacity="" Background="{StaticResource HoverShineBrush}" />
- </ControlTemplate>
- </Grid.Resources>
- <VisualStateManager.VisualStateGroups>
- <VisualStateGroup x:Name="CommonStates">
- <VisualState x:Name="Normal" />
- <VisualState x:Name="MouseOver" />
- <VisualState x:Name="Disabled">
- <Storyboard>
- <DoubleAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(UIElement.Opacity)">
- <SplineDoubleKeyFrame KeyTime="" Value="0.5" />
- </DoubleAnimationUsingKeyFrames>
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- <Grid x:Name="HorizontalTemplate" Margin="0,0,0,0" Background="Transparent">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <Rectangle Margin="0,4,0,4" Grid.Column="" Grid.ColumnSpan="" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Opacity="0.8" RadiusX="" RadiusY="" />
- <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton" Margin="0,4,0,4" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate2}" Grid.Column="" />
- <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton" Margin="0,4,0,4" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate1}" Grid.Column="" />
- <Thumb x:Name="HorizontalThumb" Height="{TemplateBinding Height}" Width="" Grid.Column="" IsTabStop="True" Style="{StaticResource ZoomBarThumbStyle}" />
- </Grid>
- <Grid x:Name="VerticalTemplate" Margin="0,0,0,0" Visibility="Collapsed" Background="Transparent">
- <Grid.RowDefinitions>
- <RowDefinition Height="*" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Rectangle Margin="4,0,4,0" Grid.Row="" Grid.RowSpan="" Fill="{TemplateBinding Background}"
- Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Opacity="0.8" RadiusX="" RadiusY="" />
- <RepeatButton x:Name="VerticalTrackLargeChangeDecreaseRepeatButton" Margin="4,0,4,0" IsTabStop="False"
- Template="{StaticResource RepeatButtonTemplate2}" Grid.Row="" />
- <RepeatButton x:Name="VerticalTrackLargeChangeIncreaseRepeatButton" Margin="4,0,4,0" IsTabStop="False"
- Template="{StaticResource RepeatButtonTemplate1}" Grid.Row="" BorderBrush="{StaticResource HoverShineBrush}" />
- <Grid Margin="6,2,6,2" Grid.Row=""
- Grid.RowSpan="" HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch" IsHitTestVisible="False"
- Background="#FFFBF9FA" >
- <Grid.RowDefinitions>
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
- </Grid>
- <Thumb x:Name="VerticalThumb"
- Width="{TemplateBinding Width}" Grid.Row="" Height="" IsTabStop="True"
- Style="{StaticResource ZoomBarThumbStyle}" >
- <Thumb.BorderBrush>
- <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
- <GradientStop Color="#FFA3AEB9" Offset=""/>
- <GradientStop Color="#FF8399A9" Offset="0.375"/>
- <GradientStop Color="#FF718597" Offset="0.375"/>
- <GradientStop Color="#FF6C84A4" Offset=""/>
- </LinearGradientBrush>
- </Thumb.BorderBrush>
- <Thumb.Background>
- <RadialGradientBrush>
- <GradientStop Color="#FF749DD2" Offset=""/>
- <GradientStop Color="#FF749DD2" Offset=""/>
- </RadialGradientBrush>
- </Thumb.Background>
- </Thumb>
- </Grid>
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Grid.Resources>
- <Grid.RowDefinitions>
- <RowDefinition Height="" />
- <RowDefinition Height="" />
- <RowDefinition />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <VisualStateManager.VisualStateGroups>
- <VisualStateGroup x:Name="CommonStates" >
- <VisualState x:Name="Normal" />
- <VisualState x:Name="MouseOver">
- <Storyboard>
- <DoubleAnimation Storyboard.TargetName="NavigatorRootGrid" Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0" />
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- <Grid x:Name="Navigator" Grid.Row="" Width="" Height="" Background="Transparent" RenderTransformOrigin="0.5,0.5" Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
- <Grid.RenderTransform>
- <RotateTransform x:Name="TransformRotate" Angle=""/>
- </Grid.RenderTransform>
- <Ellipse x:Name="RotateRing1" Width="" Height="" HorizontalAlignment="Center"
- VerticalAlignment="Center" StrokeThickness="{TemplateBinding BorderThickness}"
- Stroke="#FFA6A6A6">
- <Ellipse.Fill>
- <RadialGradientBrush>
- <GradientStop Color="#FFFBF9FA" Offset=""/>
- <GradientStop Color="#FFFBF9FA" Offset=""/>
- </RadialGradientBrush>
- </Ellipse.Fill>
- </Ellipse>
- <local:ButtonGrid x:Name="PanUp" Margin="0,2,0,0"
- BackgroundShape="M0.0,4.0 A10,3.0 0 0 1 20,4.0 L16,16 A8.0,4.0 0 0 0 4.0,16 L0.0,4.0 z"
- ForegroundShape="M0.0,1.0 L0.5,0.0 L1.0,1.0 z" Width="" Height="" ForeBorderBrush="Transparent"
- ForeBorderThick="" ForeShapeFill="{TemplateBinding Foreground}" MouseOverBackFill="#F0999999"
- MouseOverForeFill="Cyan" VerticalAlignment="Top" HorizontalAlignment="Center"
- ToolTipService.ToolTip="向上平移" Cursor="Hand" />
- <local:ButtonGrid x:Name="PanDown" Margin="0,0,0,2" BackgroundShape="M20,12 A10,3.0 0 0 1 0.0,12 L4.0,0.0 A8.0,4.0 0 0 0 16,0.0 L20.0,12 z"
- ForegroundShape="M0.0,0.0 L0.5,1.0 L1.0,0.0" Width="" Height=""
- ForeBorderBrush="{TemplateBinding Foreground}" MouseOverBackFill="#F0999999" MouseOverForeBorderBrush="Cyan"
- VerticalAlignment="Bottom" HorizontalAlignment="Center" ToolTipService.ToolTip="向下平移" Cursor="Hand"/>
- <local:ButtonGrid x:Name="PanLeft" Margin="2,0,0,0" BackgroundShape="M4.0,0.0 L16,4.0 A4.0,8.0 0 0 0 16,16 L4.0,20 A3.0,10 0 0 1 4.0,0.0 z"
- ForegroundShape="M1.0,0.0 L0.0,0.5 L1.0,1.0" Width="" Height=""
- ForeBorderBrush="{TemplateBinding Foreground}" MouseOverBackFill="#F0999999" MouseOverForeBorderBrush="Cyan"
- HorizontalAlignment="Left" VerticalAlignment="Center" ToolTipService.ToolTip="向左平移" Cursor="Hand"/>
- <local:ButtonGrid x:Name="PanRight" Margin="0,0,2,0" BackgroundShape="M12,0 A3.0,10 0 0 1 12,20 L0.0,16 A4.0,8.0 0 0 0 0.0,4.0 L12.0,0.0 z"
- ForegroundShape="M0.0,0.0 L1.0,0.5 L0.0,1.0" Width="" Height=""
- ForeBorderBrush="{TemplateBinding Foreground}" MouseOverBackFill="#F0999999" MouseOverForeBorderBrush="Cyan"
- HorizontalAlignment="Right" VerticalAlignment="Center" ToolTipService.ToolTip="向右平移" Cursor="Hand"/>
- <Button x:Name="ResetRotation" Margin="0,0,0,0" Visibility="Collapsed" Style="{StaticResource CircleButtonStyle}" Height="" Width=""
- HorizontalAlignment="Center" VerticalAlignment="Center" Background="#F0FFFFFF" BorderBrush="Transparent" BorderThickness=""
- ToolTipService.ToolTip="Reset Map North" Cursor="Hand">
- <Image Source="../Images/icons/i_nav.png" Width="" Height="" Stretch="Uniform" />
- </Button>
- </Grid>
- <Grid x:Name="ZoomHistoryPanel" Grid.Row="" Margin="0,8,0,8" Visibility="Collapsed" Background="Transparent" HorizontalAlignment="Center">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width=""/>
- <ColumnDefinition Width=""/>
- <ColumnDefinition Width=""/>
- </Grid.ColumnDefinitions>
- <local:ButtonGrid x:Name="ZoomBackButton" Grid.Column="" Margin="1,0,-1,0"
- BackgroundShape="M4.0,0.0 L16,4.0 A4.0,8.0 0 0 0 16,16 L4.0,20 A3.0,10 0 0 1 4.0,0.0 z"
- ForegroundShape="M1.0,0.0 L0.0,0.5 L1.0,1.0" Width="" Height="" BackShapeFill="{TemplateBinding Background}"
- ForeBorderBrush="{TemplateBinding Foreground}" MouseOverBackFill="#F0666666" MouseOverForeBorderBrush="Cyan"
- HorizontalAlignment="Left" VerticalAlignment="Center" ToolTipService.ToolTip="Zoom to Previous Extent" Cursor="Hand"/>
- <Button x:Name="ZoomFullButton" Grid.Column="" Margin="0,0,0,0" Height="" Width="" Style="{StaticResource CircleButtonStyle}" Background="#F0FFFFFF" BorderBrush="Transparent" BorderThickness="" HorizontalAlignment="Center" VerticalAlignment="Center" ToolTipService.ToolTip="Zoom to Full Extent" Cursor="Hand">
- <Image Source="../Images/icons/i_globe.png" Width="" Height="" Stretch="Uniform" />
- </Button>
- <local:ButtonGrid x:Name="ZoomNextButton" Grid.Column="" Margin="-1,0,1,0" BackgroundShape="M12,0 A3.0,10 0 0 1 12,20 L0.0,16 A4.0,8.0 0 0 0 0.0,4.0 L12.0,0.0 z" ForegroundShape="M0.0,0.0 L1.0,0.5 L0.0,1.0" Width="" Height="" BackShapeFill="{TemplateBinding Background}" ForeBorderBrush="{TemplateBinding Foreground}" MouseOverBackFill="#F0666666" MouseOverForeBorderBrush="Cyan" HorizontalAlignment="Right" VerticalAlignment="Center" ToolTipService.ToolTip="Zoom to Next Extent" Cursor="Hand"/>
- </Grid>
- <Border x:Name="ZoomSliderBorder" Grid.Row="" Background="Transparent"
- BorderBrush="Transparent" BorderThickness="" CornerRadius="" HorizontalAlignment="Center">
- <StackPanel x:Name="ZoomStack" Orientation="Vertical">
- <Button x:Name="ZoomInButton" Height="" Width="" Margin="2,4,2,0" Foreground="Black"
- BorderBrush="#FFA6A6A6" BorderThickness="" ToolTipService.ToolTip="Zoom In" Cursor="Hand" >
- <Button.Background>
- <RadialGradientBrush>
- <GradientStop Color="#FFFBF9FA" Offset=""/>
- <GradientStop Color="#FFFBF9FA" Offset=""/>
- </RadialGradientBrush>
- </Button.Background>
- <Path Stroke="#a6a6a6" StrokeThickness=""
- Width="" Height="" Stretch="Fill" Data="M0.0,0.5 L1.0,0.5 M0.5,0.0 L0.5,1.0"
- Fill="#FF949494"/>
- </Button>
- <Grid x:Name="ZoomLevelGrid">
- <Slider x:Name="ZoomSlider" Orientation="Vertical" Height="" Width="" Foreground="{StaticResource ThumbGradientBrush}"
- Minimum="" Maximum="" SmallChange="" LargeChange=""
- ToolTipService.ToolTip="拖动缩放" Style="{StaticResource ZoomSliderStyle}"
- BorderBrush="#a6a6a6" RenderTransformOrigin="0,0" Cursor="SizeNS" Background="#fbf9fa" />
- </Grid>
- <Button x:Name="ZoomOutButton" Height="" Width="" Margin="2,0,2,4" Foreground="Black"
- BorderBrush="#FFA6A6A6" BorderThickness="" ToolTipService.ToolTip="Zoom Out" Cursor="Hand">
- <Button.Background>
- <RadialGradientBrush>
- <GradientStop Color="#FFFBF9FA" Offset=""/>
- <GradientStop Color="White" Offset=""/>
- </RadialGradientBrush>
- </Button.Background>
- <Path Stroke="#a6a6a6" StrokeThickness="" Width="" Height="" Stretch="Fill" Data="M0.0,0.5 L1.0,0.5"/>
- </Button>
- </StackPanel>
- </Border>
- <ContentPresenter Grid.Row="" ContentTemplate="{TemplateBinding ContentTemplate}"
- Content="{TemplateBinding Content}"
- Margin="{TemplateBinding Padding}" />
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>

ArcGis API FOR Silverlight 做了个导航工具~的更多相关文章
- ArcGIS API for Silverlight开发入门
你用上3G手机了吗?你可能会说,我就是喜欢用nokia1100,ABCDEFG跟我 都没关系.但你不能否认3G是一种趋势,最终我们每个人都会被包裹在3G网络中.1100也不是一成不变,没准哪天为了打击 ...
- arcgis api for silverlight
原文 http://blog.sina.com.cn/s/blog_4638cf7b0100wntt.html arcgis api for silverlight(1) (2011-09-21 09 ...
- ArcGIS API for Silverlight中加载Google地形图(瓦片图)
原文:ArcGIS API for Silverlight中加载Google地形图(瓦片图) 在做水利.气象.土地等行业中,若能使用到Google的地形图那是再合适不过了,下面就介绍如何在ArcGIS ...
- 创建第一个ArcGIS API for Silverlight应用
原文:创建第一个ArcGIS API for Silverlight应用 在完成前面的开发环境搭建以后,接下来实现我们的第一个ArcGIS API forSilverlight应用程序. 接下来我们一 ...
- ArcGIS API for Silverlight开发入门准备
原文:ArcGIS API for Silverlight开发入门准备 微软的Silverlight提供了跨浏览器和跨平台开发环境,在Web中可用于创建和展现富互联网应用(RIA,Rich Inter ...
- ArcGIS API for Silverlight 点沿着线流动
原文:ArcGIS API for Silverlight 点沿着线流动 概述 前段时间做了一个项目,要求是有一些电力输送线,电力输送线或者石油管道都是有流动方向的,用户想做一个动态效果来模拟电力的输 ...
- ArcGIS API for Silverlight学习笔记
ArcGIS API for Silverlight学习笔记(一):为什么要用Silverlight API(转) 你用上3G手机了吗?你可能会说,我就是喜欢用nokia1100,ABCDEFG跟我都 ...
- arcgis api for silverlight使用google map等多个在线地图
原文 http://blog.csdn.net/leesmn/article/details/6820245 无可否认,google map实在是很漂亮.可惜对于使用arcgis api for si ...
- 扩展ArcGIS API for Silverlight/WPF 中的TextSymbol支持角度标注
原文 http://blog.csdn.net/esricd/article/details/7587136 在ArcGIS API for Silverlight/WPF中原版的TextSymbol ...
随机推荐
- Qt编程之实现在QFileDialog上添加自定义的widget
上网搜索找到的方法如下: http://www.qtforum.org/article/20841/how-to-add-a-qwidget-in-qfiledialog.html#post78422 ...
- [置顶] Responder一点也不神秘————iOS用户响应者链完全剖析
这篇文章想跟大家分享的主旨是iOS捕获用户事件的各种情况,以及内部封装的一些特殊事件. 我们先从UIButton谈起,UIButton大家使用的太多了,他特殊的地方就在于其内置的普通Default/高 ...
- JS--回到顶部代码
原文地址:http://www.cnblogs.com/liguiqiang1986/articles/3132023.html JS--回到顶部代码 <!DOCTYPE html PUBLIC ...
- 【转】基于Qt, TUIO和TSLIB的嵌入式Linux下的多点触摸设计
这个教程描述了在嵌入式linux下使用Qt如何设置一个支持多点触摸和单点触摸的输入系统.这里假定你已经有了对应的驱动程序,驱动可以从触摸屏的厂商那里获得或者使用一个linux 内核源码中已经存在的驱动 ...
- java生成字符串md5函数类(javaSE)
//实现生成MD5值 import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.B ...
- python实现二叉树和它的七种遍历
介绍: 树是数据结构中很重要的一种,基本的用途是用来提高查找效率,对于要反复查找的情况效果更佳,如二叉排序树.FP-树. 另外能够用来提高编码效率,如哈弗曼树. 代码: 用python实现树的构造和几 ...
- [置顶] LOAD语句:利用MSSQL中的xp_cmdshell功能,将指定文件夹下的指定文件,生成mysql的LOAD语句
LOAD语句:利用MSSQL中的xp_cmdshell功能,将指定文件夹下的指定文件,生成mysql的LOAD语句 declare @sql varchar(4000), @dirpath varch ...
- SQL FOR XML PATH 用法
FOR XML PATH 有的人可能知道有的人可能不知道,其实它就是将查询结果集以XML形式展现,有了它我们可以简化我们的查询语句实现一些以前可能需要借助函数活存储过程来完成的工作.那么以一个实例为主 ...
- doGet和doPost的区别
1.doGet和doPost的区别,在什么时候调用,为什么有时doPost中套用doGet 2.提交的form method=Post就执行DOPOST,否则执行GOGET 套用是不管meth ...
- 通过XSLT转换XML
Hello,every body.又与大家见面了,哈哈.今天我与大家分享一下XSLT,XSL,XML,XPath.因为项目中有些功能用到了XSLT.XML等技术.所以今天好好研究了一下这几个方面的技术 ...