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

SilverLight

开发平台:

C#

  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:local="clr-namespace:ESRI.ArcGIS.Samples"
  5. xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">
  6. <Style TargetType="ProgressBar" x:Name="GrayProgressBar">
  7. <Setter Property="Template">
  8. <Setter.Value>
  9. <ControlTemplate TargetType="ProgressBar" xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">
  10. <Grid x:Name="Root" >
  11. <vsm:VisualStateManager.VisualStateGroups>
  12. <vsm:VisualStateGroup x:Name="CommonStates">
  13. <vsm:VisualState x:Name="Determinate" />
  14. <vsm:VisualState x:Name="Indeterminate">
  15. <Storyboard RepeatBehavior="Forever">
  16. <DoubleAnimation Storyboard.TargetName="IndeterminateGradientFill" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.Transform).(TransformGroup.Children)[0].X" Duration="00:00:.5" From="0" To="20" />
  17. <ObjectAnimationUsingKeyFrames Duration="00:00:00" Storyboard.TargetName="IndeterminateRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
  18. <DiscreteObjectKeyFrame KeyTime="00:00:00">
  19. <DiscreteObjectKeyFrame.Value>
  20. <Visibility>Visible</Visibility>
  21. </DiscreteObjectKeyFrame.Value>
  22. </DiscreteObjectKeyFrame>
  23. </ObjectAnimationUsingKeyFrames>
  24. <ObjectAnimationUsingKeyFrames Duration="00:00:00" Storyboard.TargetName="DeterminateRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
  25. <DiscreteObjectKeyFrame KeyTime="00:00:00">
  26. <DiscreteObjectKeyFrame.Value>
  27. <Visibility>Collapsed</Visibility>
  28. </DiscreteObjectKeyFrame.Value>
  29. </DiscreteObjectKeyFrame>
  30. </ObjectAnimationUsingKeyFrames>
  31. </Storyboard>
  32. </vsm:VisualState>
  33. </vsm:VisualStateGroup>
  34. </vsm:VisualStateManager.VisualStateGroups>
  35. <!--Default Root Visuals for either type of ProgressBar-->
  36. <Border Name="ProgressBarTrack" CornerRadius="3" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" />
  37. <Grid x:Name="ProgressBarRootGrid">
  38. <!-- Beginning of Gradient over all visuals -->
  39. <Rectangle Canvas.ZIndex="1" x:Name="ProgressBarRootGradient" StrokeThickness="1" Margin="{TemplateBinding BorderThickness}" Stroke="#FFFFFFFF" RadiusX="1.5" RadiusY="1.5">
  40. <Rectangle.Fill>
  41. <LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0">
  42. <GradientStop Color="#8BFFFFFF" Offset="0"/>
  43. <GradientStop Color="#A8FFFFFF" Offset="0.15"/>
  44. <GradientStop Color="#B3FFFFFF" Offset="0.275"/>
  45. <GradientStop Color="#A7FFFFFF" Offset="0.4"/>
  46. <GradientStop Color="#93FFFFFF" Offset="0.641"/>
  47. <GradientStop Color="#8BFFFFFF" Offset="0.75"/>
  48. <GradientStop Color="#7BFFFFFF" Offset="0.85"/>
  49. <GradientStop Color="#59FFFFFF" Offset="1"/>
  50. </LinearGradientBrush>
  51. </Rectangle.Fill>
  52. </Rectangle>
  53. <!-- Beginning of Indeterminate Progress Bar Visuals-->
  54. <Grid x:Name="IndeterminateRoot" Visibility="Collapsed">
  55. <Rectangle x:Name="IndeterminateSolidFill" Stroke="#FF448DCA" RadiusX="2" RadiusY="2" StrokeThickness="0" Margin="{TemplateBinding BorderThickness}" Fill="{TemplateBinding Foreground}" Opacity="1" RenderTransformOrigin="0.5,0.5" />
  56. <Rectangle x:Name="IndeterminateGradientFill" RadiusX="2" RadiusY="2" StrokeThickness="1" Margin="{TemplateBinding BorderThickness}" Opacity="1">
  57. <Rectangle.Fill>
  58. <LinearGradientBrush SpreadMethod="Repeat" MappingMode="Absolute" EndPoint="0,1" StartPoint="20,1">
  59. <LinearGradientBrush.Transform>
  60. <TransformGroup>
  61. <TranslateTransform X="0" />
  62. <SkewTransform AngleX="-30" />
  63. </TransformGroup>
  64. </LinearGradientBrush.Transform>
  65. <GradientStop Color="#FF000000" Offset="0" />
  66. <GradientStop Color="#00000000" Offset=".25" />
  67. <GradientStop Color="#FF000000" Offset="0.85" />
  68. </LinearGradientBrush>
  69. </Rectangle.Fill>
  70. </Rectangle>
  71. </Grid>
  72. <!-- Beginning of Determinate Progress Bar Visuals-->
  73. <Grid x:Name="DeterminateRoot" Margin="1">
  74. <!--Background -->
  75. <Rectangle HorizontalAlignment="Left" x:Name="ProgressBarIndicator" Margin="{TemplateBinding BorderThickness}" StrokeThickness="0.5" RadiusX="1.5" RadiusY="1.5" Fill="{TemplateBinding Foreground}" />
  76. </Grid>
  77. </Grid>
  78. </Grid>
  79. </ControlTemplate>
  80. </Setter.Value>
  81. </Setter>
  82. </Style>
  83. <Style TargetType="local:MapProgress">
  84. <Setter Property="Template">
  85. <Setter.Value>
  86. <ControlTemplate TargetType="local:MapProgress">
  87. <Grid x:Name="root">
  88. <vsm:VisualStateManager.VisualStateGroups>
  89. <vsm:VisualStateGroup x:Name="CommonStates">
  90. <vsm:VisualState x:Name="Show">
  91. <Storyboard>
  92. <DoubleAnimation Storyboard.TargetName="root" Storyboard.TargetProperty="Opacity"
  93.  To="1" Duration="0:0:.5" BeginTime="0:0:0.25" />
  94. </Storyboard>
  95. </vsm:VisualState>
  96. <vsm:VisualState x:Name="Hide">
  97. <Storyboard>
  98. <DoubleAnimation Storyboard.TargetName="root" Storyboard.TargetProperty="Opacity"
  99.  To="0" Duration="0:0:0.2" />
  100. </Storyboard>
  101. </vsm:VisualState>
  102. </vsm:VisualStateGroup>
  103. </vsm:VisualStateManager.VisualStateGroups>
  104. <ProgressBar Minimum="0" Maximum="100" x:Name="Progress" Background="Gray" Foreground="Black" BorderBrush="Black"
  105.  Width="150" Height="12" Style="{StaticResource GrayProgressBar}" />
  106. <TextBlock x:Name="ValueText" HorizontalAlignment="Center" VerticalAlignment="Center"
  107.     FontWeight="Bold" FontSize="10" FontFamily="Arial" />
  108. </Grid>
  109. </ControlTemplate>
  110. </Setter.Value>
  111. </Setter>
  112. </Style>
  113. </ResourceDictionary>