原文 http://www.cnblogs.com/thinkaspx/archive/2012/08/08/2628214.html

转载请注明文章出处:http://www.cnblogs.com/thinkaspx

地图是读取的谷歌图层。。

主要是导航工具 做出来费劲呀。。

马上上代码

  1. namespace ZoomwayWebGis.Controls.Generic
  2. {
  3. [TemplatePart(Name = "PanLeft", Type = typeof(FrameworkElement))]
  4. [TemplatePart(Name = "PanRight", Type = typeof(FrameworkElement))]
  5. [TemplatePart(Name = "PanUp", Type = typeof(FrameworkElement))]
  6. [TemplatePart(Name = "PanDown", Type = typeof(FrameworkElement))]
  7. [TemplatePart(Name = "ZoomSlider", Type = typeof(Slider))]
  8. [TemplatePart(Name = "ZoomInButton", Type = typeof(Button))]
  9. [TemplatePart(Name = "ZoomOutButton", Type = typeof(Button))]
  10. [TemplatePart(Name = "InstanceMark", Type = typeof(Button))]
  11. public class MapNavigator : ContentControl
  12. {
  13. FrameworkElement PanLeft;
  14. FrameworkElement PanRight;
  15. FrameworkElement PanUp;
  16. FrameworkElement PanDown;
  17. Button ZoomInButton;
  18. Button ZoomOutButton;
  19. Slider ZoomSlider;
  20.  
  21. private double _panFactor = 0.5;
  22. private const double MaxResolution = 23218.433769164774;
  23. private const double MinResolution = 0.59716428347743467;
  24.  
  25. public MapNavigator()
  26. {
  27. this.DefaultStyleKey = typeof(MapNavigator);
  28. }
  29.  
  30. public override void OnApplyTemplate()
  31. {
  32. base.OnApplyTemplate();
  33.  
  34. PanLeft = GetTemplateChild("PanLeft") as FrameworkElement;
  35. PanRight = GetTemplateChild("PanRight") as FrameworkElement;
  36. PanUp = GetTemplateChild("PanUp") as FrameworkElement;
  37. PanDown = GetTemplateChild("PanDown") as FrameworkElement;
  38. ZoomSlider = GetTemplateChild("ZoomSlider") as Slider;
  39. ZoomInButton = GetTemplateChild("ZoomInButton") as Button;
  40. ZoomOutButton = GetTemplateChild("ZoomOutButton") as Button;
  41.  
  42. enablePanElement(PanLeft);
  43. enablePanElement(PanRight);
  44. enablePanElement(PanUp);
  45. enablePanElement(PanDown);
  46.  
  47. // Set control's flow direction to LTR to avoid flipping East and West keys:
  48. this.FlowDirection = System.Windows.FlowDirection.LeftToRight;
  49.  
  50. if (ZoomSlider != null)
  51. {
  52. if (Map != null)
  53. {
  54. SetupZoom();
  55. }
  56.  
  57. ZoomSlider.Minimum = ;
  58. ZoomSlider.Maximum = ;
  59. ZoomSlider.SmallChange = .;
  60. ZoomSlider.LargeChange = .;
  61. ZoomSlider.LostMouseCapture += ZoomSlider_LostMouseCapture;
  62. ZoomSlider.LostFocus += ZoomSlider_LostMouseCapture;
  63. }
  64. if (ZoomInButton != null)
  65. ZoomInButton.Click += ZoomInButton_Click;
  66. if (ZoomOutButton != null)
  67. ZoomOutButton.Click += ZoomOutButton_Click;
  68.  
  69. bool isDesignMode = System.ComponentModel.DesignerProperties.GetIsInDesignMode(this);
  70. if (isDesignMode)
  71. mouseOver = isDesignMode;
  72. ChangeVisualState(false);
  73. }
  74.  
  75. private void ZoomOutButton_Click(object sender, RoutedEventArgs e)
  76. {
  77. Map.Zoom( / Map.ZoomFactor);
  78. }
  79.  
  80. private void ZoomInButton_Click(object sender, RoutedEventArgs e)
  81. {
  82. Map.Zoom(Map.ZoomFactor);
  83. }
  84.  
  85. private void Map_ExtentChanged(object sender, ExtentEventArgs args)
  86. {
  87. if (!double.IsNaN(Map.Resolution) && ZoomSlider != null)
  88. ZoomSlider.Value = ResolutionToValue(Map.Resolution);
  89. }
  90.  
  91. #region State management
  92.  
  93. private bool mouseOver = false;
  94.  
  95. protected override void OnMouseLeave(MouseEventArgs e)
  96. {
  97. mouseOver = false;
  98. if (!trackingRotation)
  99. ChangeVisualState(true);
  100. base.OnMouseLeave(e);
  101. }
  102.  
  103. protected override void OnMouseEnter(MouseEventArgs e)
  104. {
  105. mouseOver = true;
  106. ChangeVisualState(true);
  107. base.OnMouseEnter(e);
  108. }
  109.  
  110. private void ChangeVisualState(bool useTransitions)
  111. {
  112. if (mouseOver)
  113. {
  114. GoToState(useTransitions, "MouseOver");
  115. }
  116. else
  117. {
  118. GoToState(useTransitions, "Normal");
  119. }
  120. }
  121.  
  122. private bool GoToState(bool useTransitions, string stateName)
  123. {
  124. return VisualStateManager.GoToState(this, stateName, useTransitions);
  125. }
  126.  
  127. #endregion
  128.  
  129. #region Rotation
  130.  
  131. Point startMousePos;
  132. private double angle = ;
  133. private bool trackingRotation = false;
  134.  
  135. private double GetAngle(Point a, Point b)
  136. {
  137. if (a == null || b == null) return ;
  138. return Math.Atan2((b.X - a.X), (a.Y - b.Y)) / Math.PI * ;
  139. }
  140.  
  141. #endregion
  142.  
  143. #region Zoom
  144.  
  145. private void ZoomSlider_LostMouseCapture(object sender, EventArgs e)
  146. {
  147. Map.ZoomToResolution(ValueToResolution(ZoomSlider.Value));
  148. }
  149.  
  150. #endregion
  151.  
  152. private void enablePanElement(FrameworkElement element)
  153. {
  154. if (element == null) return;
  155. element.MouseLeave += panElement_MouseLeftButtonUp;
  156. element.MouseLeftButtonDown += panElement_MouseLeftButtonDown;
  157. element.MouseLeftButtonUp += panElement_MouseLeftButtonUp;
  158. }
  159.  
  160. private void panElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  161. {
  162. if (Map == null || sender == null) return;
  163.  
  164. Envelope env = Map.Extent;
  165. if (env == null) return;
  166. double x = , y = ;
  167. MapPoint oldCenter = env.GetCenter();
  168. MapPoint newCenter = null;
  169. var height = env.Height * _panFactor;
  170. var width = env.Width * _panFactor;
  171. // if units are degrees (the default), limit or alter panning to the lat/lon limits
  172. if (sender == PanUp) // North
  173. {
  174. y = oldCenter.Y + height;
  175. newCenter = new MapPoint(oldCenter.X, y);
  176. }
  177. else if (sender == PanRight) // East
  178. {
  179. x = oldCenter.X + width;
  180. newCenter = new MapPoint(x, oldCenter.Y);
  181. }
  182. else if (sender == PanLeft) // West
  183. {
  184. x = oldCenter.X - width;
  185. newCenter = new MapPoint(x, oldCenter.Y);
  186. }
  187. else if (sender == PanDown) // South
  188. {
  189. y = oldCenter.Y - height;
  190. newCenter = new MapPoint(oldCenter.X, y);
  191. }
  192.  
  193. if (newCenter != null)
  194. Map.PanTo(newCenter);
  195.  
  196. }
  197.  
  198. private void panElement_MouseLeftButtonUp(object sender, MouseEventArgs e)
  199. {
  200. if (Map == null) return;
  201. }
  202.  
  203. private double ValueToResolution(double value)
  204. {
  205. double max = Math.Log10(MaxResolution);
  206. double min = Math.Log10(MinResolution);
  207. double resLog = ( - value) * (max - min) + min;
  208. return Math.Pow(, resLog);
  209. }
  210.  
  211. private double ResolutionToValue(double resolution)
  212. {
  213. double max = Math.Log10(MaxResolution);
  214. double min = Math.Log10(MinResolution);
  215. double value = - ((Math.Log10(resolution) - min) / (max - min));
  216. return Math.Min(, Math.Max(value, )); //cap values between 0..1
  217. }
  218.  
  219. public void SetupZoom()
  220. {
  221. if (ZoomSlider != null && Map != null)
  222. {
  223. if (!double.IsNaN(MinResolution) && !double.IsNaN(MaxResolution) &&
  224. MaxResolution != double.MaxValue &&
  225. MinResolution != double.Epsilon &&
  226. !double.IsNaN(Map.Resolution))
  227. {
  228. ZoomSlider.Value = ResolutionToValue(Map.Resolution);
  229. }
  230. }
  231. }
  232.  
  233. #region Properties
  234.  
  235. public static readonly DependencyProperty MapProperty = DependencyProperty.Register("Map", typeof(Map), typeof(MapNavigator), new PropertyMetadata(OnMapPropertyChanged));
  236.  
  237. private static void OnMapPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
  238. {
  239. MapNavigator nav = d as MapNavigator;
  240. Map map = e.NewValue as Map;
  241. Map oldmap = e.OldValue as Map;
  242.  
  243. if (oldmap != null)
  244. {
  245. oldmap.RotationChanged -= nav.Map_RotationChanged;
  246. oldmap.ExtentChanged -= nav.Map_ExtentChanged;
  247. oldmap.ExtentChanging -= nav.Map_ExtentChanged;
  248. if (oldmap.Layers != null)
  249. oldmap.Layers.LayersInitialized -= nav.Layers_LayersInitialized;
  250. }
  251. if (map != null)
  252. {
  253. map.RotationChanged += nav.Map_RotationChanged;
  254. map.ExtentChanged += nav.Map_ExtentChanged;
  255. map.ExtentChanging += nav.Map_ExtentChanged;
  256. if (map.Layers != null)
  257. map.Layers.LayersInitialized += nav.Layers_LayersInitialized;
  258. nav.SetupZoom();
  259. }
  260. }
  261.  
  262. private void Layers_LayersInitialized(object sender, EventArgs args)
  263. {
  264. SetupZoom();
  265. }
  266.  
  267. public Map Map
  268. {
  269. get { return GetValue(MapProperty) as Map; }
  270. set { SetValue(MapProperty, value); }
  271. }
  272.  
  273. public Double PanFactor { get { return _panFactor; } set { _panFactor = value; } }
  274.  
  275. private void Map_RotationChanged(object sender, DependencyPropertyChangedEventArgs e)
  276. {
  277. double value = (this.FlowDirection == System.Windows.FlowDirection.LeftToRight) ? (double)e.NewValue : -(double)e.NewValue;
  278. angle = (double)e.NewValue;
  279. }
  280.  
  281. #endregion
  282. }
  1. <Style TargetType="nmap:MapNavigator">
  2. <Setter Property="Foreground" Value="White" />
  3. <Setter Property="Background" Value="#F0999988" />
  4. <Setter Property="BorderBrush" Value="Transparent"/>
  5. <Setter Property="BorderThickness" Value=""/>
  6. <Setter Property="Template">
  7. <Setter.Value>
  8. <ControlTemplate TargetType="nmap:MapNavigator">
  9. <Grid x:Name="NavigatorRootGrid" Background="Transparent" RenderTransformOrigin="0.5,0.5" Opacity="">
  10. <Grid.Resources>
  11. <RadialGradientBrush x:Key="CircleButtonGradientBrush" GradientOrigin="0.25,0.25">
  12. <GradientStop Offset="0.25" Color="#99CCCCCC"/>
  13. <GradientStop Offset="1.00" Color="#99000000"/>
  14. </RadialGradientBrush>
  15.  
  16. <SolidColorBrush x:Key="HoverShineBrush" Color="#749dd2" />
  17. <DropShadowEffect x:Key="HoverShineEffect" Color="#749dd2" BlurRadius="" ShadowDepth="" />
  18.  
  19. <LinearGradientBrush x:Key="ThumbGradientBrush" EndPoint="0.5,0.95" StartPoint="0.5,0.05">
  20. <GradientStop Color="#749dd2" Offset="" />
  21. <GradientStop Color="#749dd2" Offset="" />
  22. </LinearGradientBrush>
  23.  
  24. <LinearGradientBrush x:Key="ThumbPressedBrush" EndPoint="0.5,0.95" StartPoint="0.5,0.05">
  25. <GradientStop Color="#99CCCCCC" Offset="" />
  26. <GradientStop Color="#99333333" Offset="" />
  27. </LinearGradientBrush>
  28.  
  29. <!--Circle Button Style-->
  30. <Style TargetType="Button" x:Key="CircleButtonStyle" >
  31. <Setter Property="Background" Value="#F0CCCCCC" />
  32. <Setter Property="Foreground" Value="#FF000000" />
  33. <Setter Property="BorderBrush" Value="#F0333333" />
  34. <Setter Property="BorderThickness" Value="" />
  35. <Setter Property="Padding" Value=""/>
  36. <Setter Property="Template">
  37. <Setter.Value>
  38. <ControlTemplate xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" TargetType="Button">
  39. <Grid x:Name="ButtonRootGrid" Background="Transparent">
  40. <VisualStateManager.VisualStateGroups>
  41. <VisualStateGroup x:Name="CommonStates" >
  42. <VisualState x:Name="Normal" />
  43. <VisualState x:Name="MouseOver">
  44. <Storyboard>
  45. <DoubleAnimation Storyboard.TargetName="HoverShineShape" Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.1" />
  46. </Storyboard>
  47. </VisualState>
  48. <VisualState x:Name="Pressed" />
  49. <VisualState x:Name="Disabled">
  50. <Storyboard>
  51. <DoubleAnimation Storyboard.TargetName="DisabledMask" Storyboard.TargetProperty="Opacity" To="0.7" Duration="0:0:0.1" />
  52. </Storyboard>
  53. </VisualState>
  54. </VisualStateGroup>
  55. </VisualStateManager.VisualStateGroups>
  56. <Ellipse x:Name="BackgroundShape" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
  57. Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}"
  58. StrokeThickness="{TemplateBinding BorderThickness}"/>
  59. <Ellipse x:Name="HoverShineShape" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
  60. Fill="{StaticResource HoverShineBrush}" Stroke="#00FFFFFF" StrokeThickness=""
  61. Effect="{StaticResource HoverShineEffect}" Opacity="0.0" />
  62. <ContentPresenter x:Name="contentPresenter" Content="{TemplateBinding Content}"
  63. ContentTemplate="{TemplateBinding ContentTemplate}"
  64. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  65. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" />
  66. <Ellipse x:Name="DisabledMask" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
  67. Fill="#F0999999" Stroke="#00FFFFFF" StrokeThickness="" Opacity="0.0" IsHitTestVisible="false"/>
  68. </Grid>
  69. </ControlTemplate>
  70. </Setter.Value>
  71. </Setter>
  72. </Style>
  73.  
  74. <!-- Zoom Bar Thumb Style-->
  75. <Style TargetType="Thumb" x:Key="ZoomBarThumbStyle">
  76. <Setter Property="Background" Value="{StaticResource ThumbGradientBrush}" />
  77. <Setter Property="BorderThickness" Value="" />
  78. <Setter Property="IsTabStop" Value="False" />
  79. <Setter Property="Template">
  80. <Setter.Value>
  81. <ControlTemplate TargetType="Thumb">
  82. <Grid x:Name="ThumbRootGrid" Background="Transparent">
  83. <VisualStateManager.VisualStateGroups>
  84. <VisualStateGroup x:Name="CommonStates">
  85. <VisualStateGroup.Transitions>
  86. <VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver" />
  87. <VisualTransition GeneratedDuration="00:00:00.1" To="Pressed" />
  88. <VisualTransition From="Normal" GeneratedDuration="00:00:00.25" To="MouseOver" />
  89. <VisualTransition From="MouseOver" GeneratedDuration="00:00:00.25" To="Normal" />
  90. <VisualTransition From="MouseOver" GeneratedDuration="00:00:00.25" To="Pressed" />
  91. <VisualTransition From="Pressed" GeneratedDuration="00:00:00.25" To="MouseOver" />
  92. </VisualStateGroup.Transitions>
  93. <VisualState x:Name="Normal" />
  94. <VisualState x:Name="MouseOver">
  95. <Storyboard>
  96. <DoubleAnimation Storyboard.TargetName="HoverShineBorder" Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.1" />
  97. </Storyboard>
  98. </VisualState>
  99. <VisualState x:Name="Pressed">
  100. <Storyboard>
  101. <DoubleAnimation Storyboard.TargetName="PressedBorder" Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.1" />
  102. </Storyboard>
  103. </VisualState>
  104. <VisualState x:Name="Disabled">
  105. <Storyboard>
  106. <DoubleAnimation Storyboard.TargetName="DisabledBorder" Storyboard.TargetProperty="Opacity" To="0.5" Duration="0:0:0.1" />
  107. </Storyboard>
  108. </VisualState>
  109. </VisualStateGroup>
  110. </VisualStateManager.VisualStateGroups>
  111. <Border x:Name="BackgroundBorder" Background="{TemplateBinding Background}"
  112. BorderBrush="{TemplateBinding BorderBrush}"
  113. BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="" />
  114. <Border x:Name="HoverShineBorder" Background="{StaticResource HoverShineBrush}"
  115. BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
  116. CornerRadius="" Opacity="" />
  117. <Border x:Name="PressedBorder" Background="{StaticResource ThumbPressedBrush}"
  118. BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="" Opacity="" />
  119. <Border x:Name="DisabledBorder" Background="#F0999999" IsHitTestVisible="false" CornerRadius="" Opacity="" />
  120. </Grid>
  121. </ControlTemplate>
  122. </Setter.Value>
  123. </Setter>
  124. </Style>
  125.  
  126. <!-- Zoom Slider Style-->
  127. <Style TargetType="Slider" x:Key="ZoomSliderStyle">
  128. <Setter Property="BorderThickness" Value="" />
  129. <Setter Property="BorderBrush" Value="#99666666" />
  130. <Setter Property="Background" Value="Transparent" />
  131. <Setter Property="Foreground" Value="#99666666" />
  132. <Setter Property="IsTabStop" Value="False" />
  133. <Setter Property="Maximum" Value="" />
  134. <Setter Property="Minimum" Value="" />
  135. <Setter Property="Template">
  136. <Setter.Value>
  137. <ControlTemplate TargetType="Slider">
  138. <Grid x:Name="LayoutRoot" Background="Transparent">
  139. <Grid.Resources>
  140. <ControlTemplate x:Key="RepeatButtonTemplate1">
  141. <Grid x:Name="Root" Opacity="" Background="Transparent" />
  142. </ControlTemplate>
  143. <ControlTemplate x:Key="RepeatButtonTemplate2">
  144. <Grid x:Name="Root" Opacity="" Background="{StaticResource HoverShineBrush}" />
  145. </ControlTemplate>
  146. </Grid.Resources>
  147. <VisualStateManager.VisualStateGroups>
  148. <VisualStateGroup x:Name="CommonStates">
  149. <VisualState x:Name="Normal" />
  150. <VisualState x:Name="MouseOver" />
  151. <VisualState x:Name="Disabled">
  152. <Storyboard>
  153. <DoubleAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(UIElement.Opacity)">
  154. <SplineDoubleKeyFrame KeyTime="" Value="0.5" />
  155. </DoubleAnimationUsingKeyFrames>
  156. </Storyboard>
  157. </VisualState>
  158. </VisualStateGroup>
  159. </VisualStateManager.VisualStateGroups>
  160. <Grid x:Name="HorizontalTemplate" Margin="0,0,0,0" Background="Transparent">
  161. <Grid.ColumnDefinitions>
  162. <ColumnDefinition Width="Auto" />
  163. <ColumnDefinition Width="Auto" />
  164. <ColumnDefinition Width="*" />
  165. </Grid.ColumnDefinitions>
  166. <Rectangle Margin="0,4,0,4" Grid.Column="" Grid.ColumnSpan="" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Opacity="0.8" RadiusX="" RadiusY="" />
  167. <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton" Margin="0,4,0,4" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate2}" Grid.Column="" />
  168. <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton" Margin="0,4,0,4" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate1}" Grid.Column="" />
  169. <Thumb x:Name="HorizontalThumb" Height="{TemplateBinding Height}" Width="" Grid.Column="" IsTabStop="True" Style="{StaticResource ZoomBarThumbStyle}" />
  170. </Grid>
  171. <Grid x:Name="VerticalTemplate" Margin="0,0,0,0" Visibility="Collapsed" Background="Transparent">
  172. <Grid.RowDefinitions>
  173. <RowDefinition Height="*" />
  174. <RowDefinition Height="Auto" />
  175. <RowDefinition Height="Auto" />
  176. </Grid.RowDefinitions>
  177. <Rectangle Margin="4,0,4,0" Grid.Row="" Grid.RowSpan="" Fill="{TemplateBinding Background}"
  178. Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Opacity="0.8" RadiusX="" RadiusY="" />
  179. <RepeatButton x:Name="VerticalTrackLargeChangeDecreaseRepeatButton" Margin="4,0,4,0" IsTabStop="False"
  180. Template="{StaticResource RepeatButtonTemplate2}" Grid.Row="" />
  181. <RepeatButton x:Name="VerticalTrackLargeChangeIncreaseRepeatButton" Margin="4,0,4,0" IsTabStop="False"
  182. Template="{StaticResource RepeatButtonTemplate1}" Grid.Row="" BorderBrush="{StaticResource HoverShineBrush}" />
  183. <Grid Margin="6,2,6,2" Grid.Row=""
  184. Grid.RowSpan="" HorizontalAlignment="Stretch"
  185. VerticalAlignment="Stretch" IsHitTestVisible="False"
  186. Background="#FFFBF9FA" >
  187. <Grid.RowDefinitions>
  188. <RowDefinition Height="*" />
  189. <RowDefinition Height="*" />
  190. <RowDefinition Height="*" />
  191. <RowDefinition Height="*" />
  192. <RowDefinition Height="*" />
  193. <RowDefinition Height="*" />
  194. <RowDefinition Height="*" />
  195. <RowDefinition Height="*" />
  196. <RowDefinition Height="*" />
  197. <RowDefinition Height="*" />
  198. <RowDefinition Height="*" />
  199. <RowDefinition Height="*" />
  200. <RowDefinition Height="*" />
  201. <RowDefinition Height="*" />
  202. <RowDefinition Height="*" />
  203. <RowDefinition Height="*" />
  204. <RowDefinition Height="*" />
  205. <RowDefinition Height="*" />
  206. <RowDefinition Height="*" />
  207. <RowDefinition Height="*" />
  208. </Grid.RowDefinitions>
  209. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  210. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  211. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  212. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  213. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  214. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  215. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  216. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  217. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  218. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  219. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  220. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  221. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  222. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  223. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  224. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  225. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  226. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  227. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  228. <Rectangle Grid.Row="" Fill="{TemplateBinding Foreground}" Stroke="#F0FFFFFF" StrokeThickness="" Margin="" RadiusX="" RadiusY="" Height="" />
  229. </Grid>
  230. <Thumb x:Name="VerticalThumb"
  231. Width="{TemplateBinding Width}" Grid.Row="" Height="" IsTabStop="True"
  232. Style="{StaticResource ZoomBarThumbStyle}" >
  233. <Thumb.BorderBrush>
  234. <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
  235. <GradientStop Color="#FFA3AEB9" Offset=""/>
  236. <GradientStop Color="#FF8399A9" Offset="0.375"/>
  237. <GradientStop Color="#FF718597" Offset="0.375"/>
  238. <GradientStop Color="#FF6C84A4" Offset=""/>
  239. </LinearGradientBrush>
  240. </Thumb.BorderBrush>
  241. <Thumb.Background>
  242. <RadialGradientBrush>
  243. <GradientStop Color="#FF749DD2" Offset=""/>
  244. <GradientStop Color="#FF749DD2" Offset=""/>
  245. </RadialGradientBrush>
  246. </Thumb.Background>
  247. </Thumb>
  248. </Grid>
  249. </Grid>
  250. </ControlTemplate>
  251. </Setter.Value>
  252. </Setter>
  253. </Style>
  254. </Grid.Resources>
  255.  
  256. <Grid.RowDefinitions>
  257. <RowDefinition Height="" />
  258. <RowDefinition Height="" />
  259. <RowDefinition />
  260. <RowDefinition Height="Auto" />
  261. </Grid.RowDefinitions>
  262.  
  263. <VisualStateManager.VisualStateGroups>
  264. <VisualStateGroup x:Name="CommonStates" >
  265. <VisualState x:Name="Normal" />
  266. <VisualState x:Name="MouseOver">
  267. <Storyboard>
  268. <DoubleAnimation Storyboard.TargetName="NavigatorRootGrid" Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0" />
  269. </Storyboard>
  270. </VisualState>
  271. </VisualStateGroup>
  272. </VisualStateManager.VisualStateGroups>
  273.  
  274. <Grid x:Name="Navigator" Grid.Row="" Width="" Height="" Background="Transparent" RenderTransformOrigin="0.5,0.5" Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
  275. <Grid.RenderTransform>
  276. <RotateTransform x:Name="TransformRotate" Angle=""/>
  277. </Grid.RenderTransform>
  278. <Ellipse x:Name="RotateRing1" Width="" Height="" HorizontalAlignment="Center"
  279. VerticalAlignment="Center" StrokeThickness="{TemplateBinding BorderThickness}"
  280. Stroke="#FFA6A6A6">
  281. <Ellipse.Fill>
  282. <RadialGradientBrush>
  283. <GradientStop Color="#FFFBF9FA" Offset=""/>
  284. <GradientStop Color="#FFFBF9FA" Offset=""/>
  285. </RadialGradientBrush>
  286. </Ellipse.Fill>
  287. </Ellipse>
  288. <local:ButtonGrid x:Name="PanUp" Margin="0,2,0,0"
  289. 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"
  290. ForegroundShape="M0.0,1.0 L0.5,0.0 L1.0,1.0 z" Width="" Height="" ForeBorderBrush="Transparent"
  291. ForeBorderThick="" ForeShapeFill="{TemplateBinding Foreground}" MouseOverBackFill="#F0999999"
  292. MouseOverForeFill="Cyan" VerticalAlignment="Top" HorizontalAlignment="Center"
  293. ToolTipService.ToolTip="向上平移" Cursor="Hand" />
  294. <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"
  295. ForegroundShape="M0.0,0.0 L0.5,1.0 L1.0,0.0" Width="" Height=""
  296. ForeBorderBrush="{TemplateBinding Foreground}" MouseOverBackFill="#F0999999" MouseOverForeBorderBrush="Cyan"
  297. VerticalAlignment="Bottom" HorizontalAlignment="Center" ToolTipService.ToolTip="向下平移" Cursor="Hand"/>
  298. <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"
  299. ForegroundShape="M1.0,0.0 L0.0,0.5 L1.0,1.0" Width="" Height=""
  300. ForeBorderBrush="{TemplateBinding Foreground}" MouseOverBackFill="#F0999999" MouseOverForeBorderBrush="Cyan"
  301. HorizontalAlignment="Left" VerticalAlignment="Center" ToolTipService.ToolTip="向左平移" Cursor="Hand"/>
  302. <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"
  303. ForegroundShape="M0.0,0.0 L1.0,0.5 L0.0,1.0" Width="" Height=""
  304. ForeBorderBrush="{TemplateBinding Foreground}" MouseOverBackFill="#F0999999" MouseOverForeBorderBrush="Cyan"
  305. HorizontalAlignment="Right" VerticalAlignment="Center" ToolTipService.ToolTip="向右平移" Cursor="Hand"/>
  306. <Button x:Name="ResetRotation" Margin="0,0,0,0" Visibility="Collapsed" Style="{StaticResource CircleButtonStyle}" Height="" Width=""
  307. HorizontalAlignment="Center" VerticalAlignment="Center" Background="#F0FFFFFF" BorderBrush="Transparent" BorderThickness=""
  308. ToolTipService.ToolTip="Reset Map North" Cursor="Hand">
  309. <Image Source="../Images/icons/i_nav.png" Width="" Height="" Stretch="Uniform" />
  310. </Button>
  311. </Grid>
  312.  
  313. <Grid x:Name="ZoomHistoryPanel" Grid.Row="" Margin="0,8,0,8" Visibility="Collapsed" Background="Transparent" HorizontalAlignment="Center">
  314. <Grid.ColumnDefinitions>
  315. <ColumnDefinition Width=""/>
  316. <ColumnDefinition Width=""/>
  317. <ColumnDefinition Width=""/>
  318. </Grid.ColumnDefinitions>
  319. <local:ButtonGrid x:Name="ZoomBackButton" Grid.Column="" Margin="1,0,-1,0"
  320. 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"
  321. ForegroundShape="M1.0,0.0 L0.0,0.5 L1.0,1.0" Width="" Height="" BackShapeFill="{TemplateBinding Background}"
  322. ForeBorderBrush="{TemplateBinding Foreground}" MouseOverBackFill="#F0666666" MouseOverForeBorderBrush="Cyan"
  323. HorizontalAlignment="Left" VerticalAlignment="Center" ToolTipService.ToolTip="Zoom to Previous Extent" Cursor="Hand"/>
  324. <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">
  325. <Image Source="../Images/icons/i_globe.png" Width="" Height="" Stretch="Uniform" />
  326. </Button>
  327. <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"/>
  328. </Grid>
  329.  
  330. <Border x:Name="ZoomSliderBorder" Grid.Row="" Background="Transparent"
  331. BorderBrush="Transparent" BorderThickness="" CornerRadius="" HorizontalAlignment="Center">
  332. <StackPanel x:Name="ZoomStack" Orientation="Vertical">
  333. <Button x:Name="ZoomInButton" Height="" Width="" Margin="2,4,2,0" Foreground="Black"
  334. BorderBrush="#FFA6A6A6" BorderThickness="" ToolTipService.ToolTip="Zoom In" Cursor="Hand" >
  335. <Button.Background>
  336. <RadialGradientBrush>
  337. <GradientStop Color="#FFFBF9FA" Offset=""/>
  338. <GradientStop Color="#FFFBF9FA" Offset=""/>
  339. </RadialGradientBrush>
  340. </Button.Background>
  341. <Path Stroke="#a6a6a6" StrokeThickness=""
  342. Width="" Height="" Stretch="Fill" Data="M0.0,0.5 L1.0,0.5 M0.5,0.0 L0.5,1.0"
  343. Fill="#FF949494"/>
  344. </Button>
  345. <Grid x:Name="ZoomLevelGrid">
  346. <Slider x:Name="ZoomSlider" Orientation="Vertical" Height="" Width="" Foreground="{StaticResource ThumbGradientBrush}"
  347. Minimum="" Maximum="" SmallChange="" LargeChange=""
  348. ToolTipService.ToolTip="拖动缩放" Style="{StaticResource ZoomSliderStyle}"
  349. BorderBrush="#a6a6a6" RenderTransformOrigin="0,0" Cursor="SizeNS" Background="#fbf9fa" />
  350. </Grid>
  351. <Button x:Name="ZoomOutButton" Height="" Width="" Margin="2,0,2,4" Foreground="Black"
  352. BorderBrush="#FFA6A6A6" BorderThickness="" ToolTipService.ToolTip="Zoom Out" Cursor="Hand">
  353. <Button.Background>
  354. <RadialGradientBrush>
  355. <GradientStop Color="#FFFBF9FA" Offset=""/>
  356. <GradientStop Color="White" Offset=""/>
  357. </RadialGradientBrush>
  358. </Button.Background>
  359. <Path Stroke="#a6a6a6" StrokeThickness="" Width="" Height="" Stretch="Fill" Data="M0.0,0.5 L1.0,0.5"/>
  360. </Button>
  361. </StackPanel>
  362. </Border>
  363.  
  364. <ContentPresenter Grid.Row="" ContentTemplate="{TemplateBinding ContentTemplate}"
  365. Content="{TemplateBinding Content}"
  366. Margin="{TemplateBinding Padding}" />
  367. </Grid>
  368. </ControlTemplate>
  369. </Setter.Value>
  370. </Setter>
  371. </Style>

ArcGis API FOR Silverlight 做了个导航工具~的更多相关文章

  1. ArcGIS API for Silverlight开发入门

    你用上3G手机了吗?你可能会说,我就是喜欢用nokia1100,ABCDEFG跟我 都没关系.但你不能否认3G是一种趋势,最终我们每个人都会被包裹在3G网络中.1100也不是一成不变,没准哪天为了打击 ...

  2. arcgis api for silverlight

    原文 http://blog.sina.com.cn/s/blog_4638cf7b0100wntt.html arcgis api for silverlight(1) (2011-09-21 09 ...

  3. ArcGIS API for Silverlight中加载Google地形图(瓦片图)

    原文:ArcGIS API for Silverlight中加载Google地形图(瓦片图) 在做水利.气象.土地等行业中,若能使用到Google的地形图那是再合适不过了,下面就介绍如何在ArcGIS ...

  4. 创建第一个ArcGIS API for Silverlight应用

    原文:创建第一个ArcGIS API for Silverlight应用 在完成前面的开发环境搭建以后,接下来实现我们的第一个ArcGIS API forSilverlight应用程序. 接下来我们一 ...

  5. ArcGIS API for Silverlight开发入门准备

    原文:ArcGIS API for Silverlight开发入门准备 微软的Silverlight提供了跨浏览器和跨平台开发环境,在Web中可用于创建和展现富互联网应用(RIA,Rich Inter ...

  6. ArcGIS API for Silverlight 点沿着线流动

    原文:ArcGIS API for Silverlight 点沿着线流动 概述 前段时间做了一个项目,要求是有一些电力输送线,电力输送线或者石油管道都是有流动方向的,用户想做一个动态效果来模拟电力的输 ...

  7. ArcGIS API for Silverlight学习笔记

    ArcGIS API for Silverlight学习笔记(一):为什么要用Silverlight API(转) 你用上3G手机了吗?你可能会说,我就是喜欢用nokia1100,ABCDEFG跟我都 ...

  8. arcgis api for silverlight使用google map等多个在线地图

    原文 http://blog.csdn.net/leesmn/article/details/6820245 无可否认,google map实在是很漂亮.可惜对于使用arcgis api for si ...

  9. 扩展ArcGIS API for Silverlight/WPF 中的TextSymbol支持角度标注

    原文 http://blog.csdn.net/esricd/article/details/7587136 在ArcGIS API for Silverlight/WPF中原版的TextSymbol ...

随机推荐

  1. Qt编程之实现在QFileDialog上添加自定义的widget

    上网搜索找到的方法如下: http://www.qtforum.org/article/20841/how-to-add-a-qwidget-in-qfiledialog.html#post78422 ...

  2. [置顶] Responder一点也不神秘————iOS用户响应者链完全剖析

    这篇文章想跟大家分享的主旨是iOS捕获用户事件的各种情况,以及内部封装的一些特殊事件. 我们先从UIButton谈起,UIButton大家使用的太多了,他特殊的地方就在于其内置的普通Default/高 ...

  3. JS--回到顶部代码

    原文地址:http://www.cnblogs.com/liguiqiang1986/articles/3132023.html JS--回到顶部代码 <!DOCTYPE html PUBLIC ...

  4. 【转】基于Qt, TUIO和TSLIB的嵌入式Linux下的多点触摸设计

    这个教程描述了在嵌入式linux下使用Qt如何设置一个支持多点触摸和单点触摸的输入系统.这里假定你已经有了对应的驱动程序,驱动可以从触摸屏的厂商那里获得或者使用一个linux 内核源码中已经存在的驱动 ...

  5. java生成字符串md5函数类(javaSE)

    //实现生成MD5值 import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.B ...

  6. python实现二叉树和它的七种遍历

    介绍: 树是数据结构中很重要的一种,基本的用途是用来提高查找效率,对于要反复查找的情况效果更佳,如二叉排序树.FP-树. 另外能够用来提高编码效率,如哈弗曼树. 代码: 用python实现树的构造和几 ...

  7. [置顶] LOAD语句:利用MSSQL中的xp_cmdshell功能,将指定文件夹下的指定文件,生成mysql的LOAD语句

    LOAD语句:利用MSSQL中的xp_cmdshell功能,将指定文件夹下的指定文件,生成mysql的LOAD语句 declare @sql varchar(4000), @dirpath varch ...

  8. SQL FOR XML PATH 用法

    FOR XML PATH 有的人可能知道有的人可能不知道,其实它就是将查询结果集以XML形式展现,有了它我们可以简化我们的查询语句实现一些以前可能需要借助函数活存储过程来完成的工作.那么以一个实例为主 ...

  9. doGet和doPost的区别

    1.doGet和doPost的区别,在什么时候调用,为什么有时doPost中套用doGet 2.提交的form     method=Post就执行DOPOST,否则执行GOGET 套用是不管meth ...

  10. 通过XSLT转换XML

    Hello,every body.又与大家见面了,哈哈.今天我与大家分享一下XSLT,XSL,XML,XPath.因为项目中有些功能用到了XSLT.XML等技术.所以今天好好研究了一下这几个方面的技术 ...