-
Notifications
You must be signed in to change notification settings - Fork 298
Expand file tree
/
Copy pathBingAMapExample.xaml
More file actions
264 lines (259 loc) · 12.6 KB
/
BingAMapExample.xaml
File metadata and controls
264 lines (259 loc) · 12.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
<UserControl
x:Class="WPFDevelopers.Samples.ExampleViews.BingAMapExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:WPFDevelopers.Samples.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WPFDevelopers.Samples.ExampleViews"
xmlns:map="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF"
xmlns:mapOverlays="clr-namespace:Microsoft.Maps.MapControl.WPF.Overlays;assembly=Microsoft.Maps.MapControl.WPF"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sys="clr-namespace:System;assembly=System"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<LinearGradientBrush x:Key="MainColor" StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="0" Color="#FF020621" />
<GradientStop Offset="1" Color="#FF364BD8" />
<GradientStop Offset="0.499" Color="#FF5A6BD8" />
</LinearGradientBrush>
<ControlTemplate x:Key="CarTemplate" TargetType="map:Pushpin">
<Grid ToolTip="物资车辆">
<Ellipse
Width="35"
Height="35"
Fill="White"
Stroke="Red"
StrokeThickness="3" />
<Image
Width="25"
Height="25"
Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/AMap/Car2.png" />
</Grid>
</ControlTemplate>
<SineEase x:Key="SineOut" EasingMode="EaseOut" />
<Storyboard x:Key="AnimateRound" RepeatBehavior="Forever">
<DoubleAnimation
EasingFunction="{StaticResource WD.SineEaseOut}"
Storyboard.TargetName="Scale"
Storyboard.TargetProperty="ScaleX"
To="2"
Duration="0:0:01" />
<DoubleAnimation
EasingFunction="{StaticResource WD.SineEaseOut}"
Storyboard.TargetName="Scale"
Storyboard.TargetProperty="ScaleY"
To="2"
Duration="0:0:01" />
<DoubleAnimation
EasingFunction="{StaticResource WD.SineEaseOut}"
Storyboard.TargetProperty="Opacity"
To="0"
Duration="0:0:01" />
</Storyboard>
<Style x:Key="alarmStyle" TargetType="map:Pushpin">
<Setter Property="PositionOrigin" Value="Center" />
<Setter Property="Width" Value="60" />
<Setter Property="Height" Value="60" />
<Setter Property="ToolTip" Value="青州市" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="map:Pushpin">
<Grid>
<Ellipse
Width="40"
Height="40"
Fill="Red"
RenderTransformOrigin="0.5,0.5">
<Ellipse.OpacityMask>
<RadialGradientBrush>
<GradientStop Offset="0" Color="Transparent" />
<GradientStop Offset="1" Color="Black" />
</RadialGradientBrush>
</Ellipse.OpacityMask>
<Ellipse.RenderTransform>
<ScaleTransform x:Name="Scale" />
</Ellipse.RenderTransform>
<Ellipse.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard Storyboard="{StaticResource AnimateRound}" />
</EventTrigger>
</Ellipse.Triggers>
</Ellipse>
<Viewbox
Width="30"
Height="30"
Margin="20,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top">
<Path Data="{StaticResource WD.FlagGeometry}" Fill="Orange" />
</Viewbox>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<controls:CodeViewer Header="{Binding NavigateMenuItem.Name}">
<Grid>
<map:Map
x:Name="map"
Center="39.9132801985722,116.392009995601"
CredentialsProvider="AgXB7m7fVYxKpjEZV9rGdrRPvLgawYhi4Wvw99kk4RDspoalC3B_vQ8GKJAoxrve"
ZoomLevel="5">
<map:Map.Mode>
<map:MercatorMode />
</map:Map.Mode>
<map:MapItemsControl ItemsSource="{Binding PushpinArray, RelativeSource={RelativeSource AncestorType=local:BingAMapExample}}">
<map:MapItemsControl.ItemTemplate>
<DataTemplate>
<map:Pushpin
Background="Red"
Cursor="Hand"
Location="{Binding Location}"
MouseDown="Pushpin_MouseDown"
ToolTip="{Binding Title}">
<TextBlock Text="{Binding ID}" />
</map:Pushpin>
</DataTemplate>
</map:MapItemsControl.ItemTemplate>
</map:MapItemsControl>
<map:Pushpin Location="36.6797276003243,118.495410536117" Style="{StaticResource alarmStyle}" />
<Canvas
Width="50"
Height="80"
map:MapLayer.Position="31.9121578992881,107.233555852083"
map:MapLayer.PositionOrigin="BottomCenter"
Opacity="0.7">
<Path
Data="M 0,0 L 50,0 50,50 25,80 0,50 0,0"
Fill="ForestGreen"
Stroke="Wheat"
StrokeThickness="2" />
<TextBlock
Padding="10"
FontSize="10"
Foreground="White"
TextAlignment="Center">
这里是<LineBreak />
四川<LineBreak />
通江县<LineBreak />
</TextBlock>
</Canvas>
<map:MapLayer x:Name="CarLayer" />
</map:Map>
<DockPanel>
<Grid DockPanel.Dock="Top">
<Path
Width="200"
Height="30"
Data="M75.811064,0 L275.81107,0 275.81107,39.999999 267.12714,39.999999 267.12798,40.000499 67.127973,40.000499 0,0.00050140842 75.811064,0.00050140842 z"
Fill="{StaticResource MainColor}"
Opacity=".8"
Stretch="Fill"
Stroke="#FFCCFEFF"
StrokeThickness="1.5">
<Path.RenderTransform>
<SkewTransform AngleX="-40" />
</Path.RenderTransform>
</Path>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
FontWeight="Black"
Foreground="White"
Text="预警信息平台" />
</Grid>
<Grid
Width="200"
HorizontalAlignment="Left"
DockPanel.Dock="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle
Grid.RowSpan="3"
Fill="#FF364BD8"
Opacity=".8"
Stroke="#FFCCFEFF"
StrokeThickness="1.5" />
<TextBlock
Margin="10,10,0,0"
FontSize="16"
Foreground="White"
Text="数据信息" />
<ItemsControl
Grid.Row="1"
Margin="4,10"
ItemsSource="{Binding PushpinArray, RelativeSource={RelativeSource AncestorType=local:BingAMapExample}}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid
x:Name="PART_Grid"
Margin="4"
MouseLeftButtonDown="PART_Grid_MouseLeftButtonDown"
Tag="{Binding ID}">
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="16" />
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Ellipse
Width="20"
Height="20"
Fill="OrangeRed" />
<TextBlock HorizontalAlignment="Center" Text="{Binding ID}" />
<TextBlock
Grid.Column="1"
Margin="4,0"
Text="{Binding Title}" />
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="PART_Grid" Property="Background" Value="#FF020621" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button
Grid.Row="2"
Height="40"
Click="BtnCar_Click"
Content="物资轨迹"
Style="{StaticResource WD.PrimaryButton}" />
</Grid>
</DockPanel>
<ComboBox
Width="120"
HorizontalAlignment="Right"
VerticalAlignment="Top"
DisplayMemberPath="Value"
ItemsSource="{Binding MapStyleDic, RelativeSource={RelativeSource AncestorType=UserControl}}"
SelectedIndex="1"
SelectedValuePath="Key"
SelectionChanged="StyleComboBox_SelectionChanged" />
</Grid>
<controls:CodeViewer.SourceCodes>
<controls:SourceCodeModel CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/Map/BingAMapExample.xaml" CodeType="Xaml" />
<controls:SourceCodeModel CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/Map/BingAMapExample.xaml.cs" CodeType="CSharp" />
<controls:SourceCodeModel
CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/Map/AMapTitleLayer.cs"
CodeType="CSharp"
Haader="TitleLayer" />
<controls:SourceCodeModel
CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/Map/PushpinModel.cs"
CodeType="CSharp"
Haader="Pushpin" />
</controls:CodeViewer.SourceCodes>
</controls:CodeViewer>
</UserControl>