MapsPanel.xaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <UserControl x:Class="PRSDesktop.MapsPanel"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
  7. xmlns:dynamicGrid="clr-namespace:InABox.DynamicGrid;assembly=InABox.Wpf"
  8. xmlns:prsDesktop="clr-namespace:PRSDesktop"
  9. xmlns:wpf="clr-namespace:InABox.WPF;assembly=InABox.Wpf"
  10. mc:Ignorable="d"
  11. d:DesignHeight="450" d:DesignWidth="800">
  12. <UserControl.DataContext>
  13. <prsDesktop:MapViewModel x:Name="ViewModel" />
  14. </UserControl.DataContext>
  15. <UserControl.Resources>
  16. <prsDesktop:TestConverter x:Key="TestConverter" />
  17. <wpf:BooleanToBrushConverter x:Key="BooleanToBrushConverter" TrueValue="Yellow" FalseValue="Orange" />
  18. <DataTemplate x:Key="MapMarkerTemplate" DataType="{x:Type syncfusion:CustomDataSymbol}" >
  19. <Border
  20. x:Name="_border"
  21. CornerRadius="0,10,10,10"
  22. BorderBrush="Black"
  23. BorderThickness="0.75"
  24. Background="{Binding Data.Selected, Converter={StaticResource BooleanToBrushConverter}}"
  25. Padding="5,2,5,2"
  26. PreviewMouseDown="Image_PreviewMouseDown">
  27. <Label
  28. Content="{Binding Data.Description}"
  29. HorizontalContentAlignment="Center"
  30. VerticalContentAlignment="Center"
  31. FontSize="10"
  32. Foreground="Black"/>
  33. </Border>
  34. </DataTemplate>
  35. <!-- -->
  36. <!-- <DataTemplate x:Key="MapWayPointTemplate" DataType="{x:Type prsDesktop:MapMarker}"> -->
  37. <!-- <Border -->
  38. <!-- x:Name="_border" -->
  39. <!-- CornerRadius="0,10,10,10" -->
  40. <!-- BorderBrush="Black" -->
  41. <!-- BorderThickness="0.75" -->
  42. <!-- Background="Green" -->
  43. <!-- Padding="5,2,5,2" > -->
  44. <!-- <Label -->
  45. <!-- x:Name="Code" -->
  46. <!-- Content="Time" -->
  47. <!-- HorizontalContentAlignment="Center" -->
  48. <!-- VerticalContentAlignment="Center" -->
  49. <!-- FontSize="10" -->
  50. <!-- Background="Yellow" -->
  51. <!-- Foreground="Red"/> -->
  52. <!-- </Border> -->
  53. <!-- </DataTemplate> -->
  54. </UserControl.Resources>
  55. <Grid>
  56. <Grid.ColumnDefinitions>
  57. <ColumnDefinition Width="Auto" />
  58. <ColumnDefinition Width="*" />
  59. <ColumnDefinition Width="400" />
  60. </Grid.ColumnDefinitions>
  61. <Grid.RowDefinitions>
  62. <RowDefinition Height="Auto" />
  63. <RowDefinition Height="*" />
  64. </Grid.RowDefinitions>
  65. <Border Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Margin="0,0,2,0" BorderBrush="Gray"
  66. BorderThickness="0.75" Padding="5">
  67. <Slider x:Name="Zoom" Orientation="Vertical" ValueChanged="Zoom_ValueChanged" Minimum="1" Maximum="20"
  68. Value="{Binding Zoom, Mode=TwoWay}" />
  69. </Border>
  70. <syncfusion:SfMap
  71. x:Name="Map"
  72. Grid.Column="1"
  73. Grid.Row="0"
  74. Grid.RowSpan="2"
  75. BorderBrush="Gray"
  76. BorderThickness="0.75"
  77. PreviewMouseWheel="Map_PreviewMouseWheel"
  78. PreviewMouseDoubleClick="Map_PreviewMouseDoubleClick"
  79. PreviewMouseUp="Map_PreviewMouseUp">
  80. <syncfusion:SfMap.Layers>
  81. <prsDesktop:LiveMapsImageryLayer
  82. Style="{Binding Style}"
  83. BingMapKey="{Binding ApiKey}"
  84. Center="{Binding Center}"
  85. Radius="{Binding Radius}"
  86. Markers="{Binding Markers}"
  87. DistanceType="KiloMeter"
  88. MarkerTemplate="{StaticResource MapMarkerTemplate}">
  89. <syncfusion:ImageryLayer.SubShapeFileLayers>
  90. <syncfusion:SubShapeFileLayer >
  91. <syncfusion:SubShapeFileLayer.MapElements >
  92. <syncfusion:MapPolyline Stroke="DarkBlue" StrokeThickness="5" Points="{Binding WayPoints}" />
  93. </syncfusion:SubShapeFileLayer.MapElements>
  94. </syncfusion:SubShapeFileLayer>
  95. </syncfusion:ImageryLayer.SubShapeFileLayers>
  96. </prsDesktop:LiveMapsImageryLayer>
  97. </syncfusion:SfMap.Layers>
  98. </syncfusion:SfMap>
  99. <Border Grid.Column="2" Grid.Row="0" Margin="4,0,0,0" BorderBrush="Gray" BorderThickness="0.75"
  100. Background="WhiteSmoke">
  101. <StackPanel Orientation="Vertical">
  102. <Label Content="Map Options" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
  103. <ComboBox x:Name="Viewstyle" Margin="5,0,5,5" SelectedIndex="0"
  104. SelectionChanged="Viewstyle_SelectionChanged" Visibility="Collapsed" >
  105. <ComboBoxItem x:Name="OSMViewStyle" Content="Open Street Map" />
  106. <ComboBoxItem x:Name="BingStandardViewStyle" Content="Bing Standard View" />
  107. <ComboBoxItem x:Name="BingTerrainViewStyle" Content="Bing Terrain View" />
  108. <ComboBoxItem x:Name="BingTerrainLabelsViewStyle" Content="Bing Terrain with Labels" />
  109. <ComboBoxItem x:Name="GoogleMapsViewStyle" Content="Google Maps" />
  110. </ComboBox>
  111. <ComboBox x:Name="ViewType" Margin="5,0,5,5" DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding EntityType, Mode=TwoWay}" />
  112. <ComboBox x:Name="ViewGroup" Margin="5,0,5,5" DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding EntityGroup, Mode=TwoWay}" />
  113. </StackPanel>
  114. </Border>
  115. <dynamicGrid:DynamicTabControl
  116. x:Name="TabView"
  117. Grid.Column="2"
  118. Grid.Row="1"
  119. Margin="4,2,0,0"
  120. BorderBrush="Gray"
  121. BorderThickness="0.75"
  122. Background="WhiteSmoke"
  123. TabStripPlacement="Bottom"
  124. SelectionChanged="TabView_PageChanged">
  125. <dynamicGrid:DynamicTabItem Header="Marker List">
  126. <Grid>
  127. <Grid.ColumnDefinitions>
  128. <ColumnDefinition Width="*" />
  129. </Grid.ColumnDefinitions>
  130. <Grid.RowDefinitions>
  131. <RowDefinition Height="*" />
  132. <RowDefinition Height="Auto" />
  133. </Grid.RowDefinitions>
  134. <ListView Grid.Row="0" Grid.Column="0" x:Name="Markers" Margin="5,5,5,0"
  135. MouseDoubleClick="Markers_MouseDoubleClick"
  136. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  137. SelectionChanged="Markers_SelectionChanged">
  138. <ListView.Resources>
  139. <Style TargetType="{x:Type GridViewColumnHeader}">
  140. <Setter Property="HorizontalContentAlignment" Value="Left" />
  141. </Style>
  142. </ListView.Resources>
  143. <ListView.View>
  144. <GridView>
  145. <GridViewColumn Header="Code" DisplayMemberBinding="{Binding Code}" Width="100" />
  146. <GridViewColumn Header="Description" DisplayMemberBinding="{Binding Description}"
  147. Width="188" />
  148. <GridViewColumn Header="Updated"
  149. DisplayMemberBinding="{Binding Updated, StringFormat='{}{0:dd MMM yy}'}"
  150. Width="85" />
  151. </GridView>
  152. </ListView.View>
  153. </ListView>
  154. <DockPanel Grid.Row="2" Grid.Column="0">
  155. <Button x:Name="ResetView" DockPanel.Dock="Right" Content="Reset View" Margin="5" Width="70"
  156. Click="ResetView_Click" />
  157. <CheckBox x:Name="ShowAll" DockPanel.Dock="Left" Content="Include Hidden Markers" Margin="5"
  158. HorizontalContentAlignment="Left" VerticalContentAlignment="Center"
  159. Checked="IncludeVisibleMarkers_Checked" Unchecked="IncludeVisibleMarkers_Checked"
  160. IsThreeState="False" />
  161. </DockPanel>
  162. </Grid>
  163. </dynamicGrid:DynamicTabItem>
  164. <dynamicGrid:DynamicTabItem Header="Marker Details">
  165. <Grid>
  166. <Grid.ColumnDefinitions>
  167. <ColumnDefinition Width="Auto" />
  168. <ColumnDefinition Width="*" />
  169. </Grid.ColumnDefinitions>
  170. <Grid.RowDefinitions>
  171. <RowDefinition Height="Auto" />
  172. <RowDefinition Height="Auto" />
  173. <RowDefinition Height="Auto" />
  174. <RowDefinition Height="Auto" />
  175. <RowDefinition Height="*" />
  176. </Grid.RowDefinitions>
  177. <Label Grid.Row="0" Grid.Column="0" Margin="5" Content="Name" VerticalContentAlignment="Center" />
  178. <TextBox Grid.Row="0" Grid.Column="1" x:Name="Description" Margin="5"
  179. HorizontalContentAlignment="Left" VerticalContentAlignment="Center" />
  180. <Label Grid.Row="1" Grid.Column="0" Margin="5,0,5,5" Content="Updated"
  181. VerticalContentAlignment="Center" />
  182. <TextBox Grid.Row="1" Grid.Column="1" x:Name="LastUpdate" Margin="5,0,5,5"
  183. HorizontalContentAlignment="Left" VerticalContentAlignment="Center" />
  184. <Label Grid.Row="2" Grid.Column="0" Margin="5,0,5,5" Content="Updated By"
  185. VerticalContentAlignment="Center" />
  186. <TextBox Grid.Row="2" Grid.Column="1" x:Name="Device" Margin="5,0,5,5"
  187. HorizontalContentAlignment="Left" VerticalContentAlignment="Center" />
  188. <Border BorderBrush="Gray" BorderThickness="0.75" Padding="0,5,0,0" Grid.Row="3" Grid.Column="0"
  189. Grid.ColumnSpan="2" Margin="5" Background="White">
  190. <syncfusion:CalendarEdit x:Name="Date" ShowAbbreviatedMonthNames="True"
  191. AllowMultiplySelection="False" DateChanged="Date_DateChanged"
  192. BorderBrush="Transparent" />
  193. </Border>
  194. <ListView Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" x:Name="History" Margin="5,0,5,5"
  195. MouseDoubleClick="History_MouseDoubleClick"
  196. ScrollViewer.HorizontalScrollBarVisibility="Disabled">
  197. <ListView.Resources>
  198. <Style TargetType="{x:Type GridViewColumnHeader}">
  199. <Setter Property="HorizontalContentAlignment" Value="Left" />
  200. </Style>
  201. </ListView.Resources>
  202. <ListView.View>
  203. <GridView>
  204. <GridViewColumn Header="Date"
  205. DisplayMemberBinding="{Binding Date, StringFormat='{}{0:HH:mm}'}"
  206. Width="40" />
  207. <GridViewColumn Header="Activity" DisplayMemberBinding="{Binding Description}"
  208. Width="315" />
  209. </GridView>
  210. </ListView.View>
  211. </ListView>
  212. </Grid>
  213. </dynamicGrid:DynamicTabItem>
  214. </dynamicGrid:DynamicTabControl>
  215. </Grid>
  216. </UserControl>