App.xaml
上传用户:huazai0421
上传日期:2008-05-30
资源大小:405k
文件大小:9k
源码类别:

SilverLight

开发平台:

C#

  1. <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2.     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  3. xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
  4. xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
  5.     xmlns:visualizationToolkit="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"
  6.     xmlns:chartingPrimitives="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit"
  7.     xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
  8. xmlns:sys="clr-namespace:System;assembly=mscorlib"
  9. xmlns:globe="clr-namespace:SilverGlobe;assembly=SilverGlobe"
  10. xmlns:toolkit="clr-namespace:ESRI.ArcGIS.Client.Toolkit;assembly=ESRI.ArcGIS.Client.Toolkit"
  11. xmlns:esriSymbols="clr-namespace:ESRI.ArcGIS.Client.Symbols;assembly=ESRI.ArcGIS.Client"
  12.     xmlns:pie="clr-namespace:ESRI.ArcGIS.Samples.PieChartSymbology;assembly=ESRI.ArcGIS.Samples.PieChartSymbology"
  13. x:Class="ESRI.ArcGIS.Samples.SilverMapDemo.App" >
  14.     <Application.Resources>
  15. <ResourceDictionary>
  16. <ResourceDictionary.MergedDictionaries>
  17. <ResourceDictionary Source="Styles.Black.xaml" />
  18. </ResourceDictionary.MergedDictionaries>
  19. <sys:String x:Name="Title">Silverlight Showcase</sys:String>
  20. <sys:String x:Name="menu1">Base Map</sys:String>
  21. <sys:String x:Name="menu2">Web Feeds</sys:String>
  22. <sys:String x:Name="menu3">Weather</sys:String>
  23. <sys:String x:Name="menu4">Demographics</sys:String>
  24. <sys:String x:Name="menu5">Media</sys:String>
  25. <Style x:Name="titleTextStyle" TargetType="TextBlock">
  26. <Setter Property="Foreground" Value="White" />
  27. <Setter Property="VerticalAlignment" Value="Bottom" />
  28. <Setter Property="HorizontalAlignment" Value="Right" />
  29. <Setter Property="Margin" Value="0" />
  30. <Setter Property="Opacity" Value=".1" />
  31. <Setter Property="FontSize" Value="60" />
  32. <Setter Property="FontWeight" Value="Bold" />
  33. </Style>
  34. <Style x:Name="titleTextStyle2" TargetType="TextBlock">
  35. <Setter Property="Foreground" Value="#eeeeee" />
  36. <Setter Property="VerticalAlignment" Value="Bottom" />
  37. <Setter Property="HorizontalAlignment" Value="Right" />
  38. <Setter Property="Margin" Value="0,0,0,10" />
  39. <Setter Property="FontSize" Value="40" />
  40. <Setter Property="FontWeight" Value="Bold" />
  41. </Style>
  42. <!-- Pie Marker Symbol -->
  43. <esriSymbols:MarkerSymbol x:Name="pieMarkerSymbol">
  44. <esriSymbols:MarkerSymbol.ControlTemplate>
  45. <ControlTemplate>
  46. <Canvas RenderTransformOrigin=".5,.5" Name="RootElement">
  47. <Canvas.RenderTransform>
  48. <ScaleTransform ScaleX="1" ScaleY="1" />
  49. </Canvas.RenderTransform>
  50. <!--- Doubling the size of pie chart symbology when mouse pointer is hovered on the symbol -->
  51. <vsm:VisualStateManager.VisualStateGroups>
  52. <vsm:VisualStateGroup x:Name="CommonStates">
  53. <vsm:VisualState x:Name="Normal">
  54. <Storyboard>
  55. <DoubleAnimation BeginTime="00:00:00" 
  56.  Storyboard.TargetName="RootElement" 
  57.  Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" 
  58.  To="1" Duration="0:0:0.1" />
  59. <DoubleAnimation BeginTime="00:00:00" 
  60.  Storyboard.TargetName="RootElement" 
  61.  Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" 
  62.  To="1" Duration="0:0:0.1" />
  63. </Storyboard>
  64. </vsm:VisualState>
  65. <vsm:VisualState x:Name="MouseOver">
  66. <Storyboard>
  67. <DoubleAnimation BeginTime="00:00:00" 
  68.  Storyboard.TargetName="RootElement" 
  69.  Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" 
  70.  To="2" Duration="0:0:0.1" />
  71. <DoubleAnimation BeginTime="00:00:00" 
  72.  Storyboard.TargetName="RootElement" 
  73.  Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" 
  74.  To="2" Duration="0:0:0.1" />
  75. </Storyboard>
  76. </vsm:VisualState>
  77. </vsm:VisualStateGroup>
  78. </vsm:VisualStateManager.VisualStateGroups>
  79. <pie:PieChartMapTip Width="20" Height="20"
  80.    Canvas.Left="-10" Canvas.Top="-10"
  81.    DataContext="{Binding Path=Attributes}">
  82. <pie:PieChartMapTip.Template>
  83. <ControlTemplate>
  84. <Grid>
  85. <Grid.Resources>
  86. <Style TargetType="Panel" x:Name="chartStyle">
  87. <Setter Property="MinWidth" Value="0"/>
  88. <Setter Property="MinHeight" Value="0"/>
  89. </Style>
  90. </Grid.Resources>
  91. <chartingToolkit:Chart Name="pieChart" UseLayoutRounding="True">
  92. <chartingToolkit:Chart.Resources>
  93. <ControlTemplate x:Key="PieDataPointControlTemplate" TargetType="chartingToolkit:PieDataPoint">
  94. <Grid>
  95. <Path x:Name="Slice" Data="{TemplateBinding Geometry}" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}">
  96. <ToolTipService.ToolTip>
  97. <StackPanel>
  98. <ContentControl FontWeight="Bold" Content="{TemplateBinding IndependentValue}"/>
  99. <ContentControl Foreground="DarkBlue" Content="{TemplateBinding FormattedDependentValue}"/>
  100. <ContentControl Foreground="DarkBlue" Content="{TemplateBinding FormattedRatio}"/>
  101. </StackPanel>
  102. </ToolTipService.ToolTip>
  103. </Path>
  104. </Grid>
  105. </ControlTemplate>
  106. </chartingToolkit:Chart.Resources>
  107. <chartingToolkit:Chart.Series>
  108. <chartingToolkit:PieSeries Name="mainPieSeries" Margin="0" 
  109.    IndependentValueBinding="{Binding Path=Key}" 
  110.    DependentValueBinding="{Binding Path=Value}">
  111. <chartingToolkit:PieSeries.StylePalette>
  112. <visualizationToolkit:StylePalette>
  113. <Style TargetType="chartingToolkit:PieDataPoint">
  114. <Setter Property="Background" Value="DarkRed" />
  115. <Setter Property="BorderBrush" Value="{x:Null}" />
  116. <Setter Property="Template" Value="{StaticResource PieDataPointControlTemplate}"/>
  117. </Style>
  118. <Style TargetType="chartingToolkit:PieDataPoint">
  119. <Setter Property="Background" Value="Yellow" />
  120. <Setter Property="BorderBrush" Value="{x:Null}" />
  121. <Setter Property="Template" Value="{StaticResource PieDataPointControlTemplate}"/>
  122. </Style>
  123. <Style TargetType="chartingToolkit:PieDataPoint">
  124. <Setter Property="Background" Value="DarkBlue"/>
  125. <Setter Property="BorderBrush" Value="{x:Null}" />
  126. <Setter Property="Template" Value="{StaticResource PieDataPointControlTemplate}"/>
  127. </Style>
  128. <Style TargetType="Control">
  129. <Setter Property="Background" Value="DarkOrange" />
  130. <Setter Property="BorderBrush" Value="{x:Null}" />
  131. <Setter Property="Template" Value="{StaticResource PieDataPointControlTemplate}"/>
  132. </Style>
  133. <Style TargetType="Control">
  134. <Setter Property="Background" Value="SteelBlue" />
  135. <Setter Property="BorderBrush" Value="{x:Null}" />
  136. <Setter Property="Template" Value="{StaticResource PieDataPointControlTemplate}"/>
  137. </Style>
  138. <Style TargetType="Control">
  139. <Setter Property="Background" Value="DarkGreen"/>
  140. <Setter Property="BorderBrush" Value="{x:Null}" />
  141. <Setter Property="Template" Value="{StaticResource PieDataPointControlTemplate}"/>
  142. </Style>
  143. <Style TargetType="Control">
  144. <Setter Property="Background" Value="DarkCyan"/>
  145. <Setter Property="BorderBrush" Value="{x:Null}" />
  146. <Setter Property="Template" Value="{StaticResource PieDataPointControlTemplate}"/>
  147. </Style>
  148. <Style TargetType="Control">
  149. <Setter Property="Background" Value="DarkOliveGreen"/>
  150. <Setter Property="BorderBrush" Value="{x:Null}" />
  151. <Setter Property="Template" Value="{StaticResource PieDataPointControlTemplate}"/>
  152. </Style>
  153. </visualizationToolkit:StylePalette>
  154. </chartingToolkit:PieSeries.StylePalette>
  155. </chartingToolkit:PieSeries>
  156. </chartingToolkit:Chart.Series>
  157. <chartingToolkit:Chart.Template>
  158. <ControlTemplate TargetType="chartingToolkit:Chart">
  159. <chartingPrimitives:EdgePanel x:Name="ChartArea" />
  160. </ControlTemplate>
  161. </chartingToolkit:Chart.Template>
  162. </chartingToolkit:Chart>
  163. </Grid>
  164. </ControlTemplate>
  165. </pie:PieChartMapTip.Template>
  166. </pie:PieChartMapTip>
  167. </Canvas>
  168. </ControlTemplate>
  169. </esriSymbols:MarkerSymbol.ControlTemplate>
  170. </esriSymbols:MarkerSymbol>
  171. </ResourceDictionary>
  172. </Application.Resources>
  173. </Application>