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 ...
随机推荐
- GetProcessMemoryInfo API取得进程所用的内存
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683219(v=vs.85).aspx 例子: https://msdn.mic ...
- hdu5772-String problem(最大权闭合子图问题)
解析: 多校标答 第一类:Pij 表示第i个点和第j个点组合的点,那么Pij的权值等于w[i][j]+w[j][i](表示得分)第二类:原串中的n个点每个点拆出一个点,第i个点权值为 –a[s[i]] ...
- 利用内存结构及多线程优化多图片下载(IOS篇)
利用内存结构及多线程优化多图片下载(IOS篇) 前言 下载地址, 后续发布, 请继续关注本blog 在IOS中,我们常常遇到多图片下载的问题.最简单的解决方案是直接利用别人写好的框架.但是这如同练武, ...
- python高级编程之访问超类中的方法:super()
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' #超类01 #它是一个内建类型,用于访问属于某个对象超类特性 pri ...
- STS(Spring Tool Suite)使用前准备
sts 的基础框架拿的eclipse的,你可以理解为eclipse + spring插件的高级升华版.在使用上可以很大限度的参考eclipse的操作. 首先,调整字体. 中文很麻烦的,因为编码问题.习 ...
- Oracle通过指令创建用户
Oracle作为世界上使用最广泛的关系数据库,对于客户很多每天海量数据的公司是首要选择.我们公司在双十一期间,曾发生过每网点每天1G多的扫描数据量,全国有六千多个网点,每天每时不停读写数据库,而数据库 ...
- 写PPT的方法
这个方法是今天同事的方法,看到他的PPT简洁高效,明了,记下了他的方法: 写文字:写框架,这个框架或者内容可以是word形式的,目的是展示内容 找模板:在搜集到的各种ppt模板中选几个适合自己文字的页 ...
- html5 拖放---(二)转
draggable是一个枚举属性,用于指定一个标签是否可以被拖拽.有以下四种取值: true 表示此元素可拖拽 false 表示此元素不可拖拽 auto 除img和带href的标签a标签表示可拖拽外, ...
- .NET winform 的keypress事件中判断当用户按下的是哪个键
keys是按键的枚举类型 private void txtPropertyValue_KeyPress(object sender, KeyPressEventArgs e) { if ((Keys) ...
- Entity Framework 6.1-Code First【转】
Entity Framework 6.1-Code First 分类: Entity Framework 2014-04-21 14:56 2034人阅读 评论(0) 收藏 举报 entityen ...