你的位置:首页 > ASP.net教程

[ASP.net教程]WPF使用样式更新ArcGis InfoWindow外观代码


<Style x:Key="mainInfoWindowStyleMF" TargetType="{x:Type esri:InfoWindow}">      <Setter Property="Background" Value="Red"/>      <Setter Property="BorderBrush" Value="Blue"/>      <Setter Property="HorizontalAlignment" Value="Left"/>      <Setter Property="VerticalAlignment" Value="Top"/>      <Setter Property="Padding" Value="0"/>      <Setter Property="Margin" Value="0,20,0,0"></Setter>      <Setter Property="Template">        <Setter.Value>          <ControlTemplate TargetType="{x:Type esri:InfoWindow}">            <Grid x:Name="Root" Height="{TemplateBinding Height}" RenderTransformOrigin="{Binding RenderTransformOrigin, RelativeSource={RelativeSource TemplatedParent}}" SnapsToDevicePixels="True">              <Grid.RenderTransform>                <ScaleTransform ScaleY="0" ScaleX="0"/>              </Grid.RenderTransform>              <VisualStateManager.VisualStateGroups>                <VisualStateGroup x:Name="CommonStates">                  <VisualState x:Name="Show">                    <Storyboard>                      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" Storyboard.TargetName="Root">                        <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1">                          <EasingDoubleKeyFrame.EasingFunction>                            <BackEase Amplitude="0.5" EasingMode="EaseOut"/>                          </EasingDoubleKeyFrame.EasingFunction>                        </EasingDoubleKeyFrame>                      </DoubleAnimationUsingKeyFrames>                      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" Storyboard.TargetName="Root">                        <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1">                          <EasingDoubleKeyFrame.EasingFunction>                            <BackEase Amplitude="0.5" EasingMode="EaseOut"/>                          </EasingDoubleKeyFrame.EasingFunction>                        </EasingDoubleKeyFrame>                      </DoubleAnimationUsingKeyFrames>                    </Storyboard>                  </VisualState>                  <VisualState x:Name="Hide">                    <Storyboard>                      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" Storyboard.TargetName="Root">                        <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="0">                          <EasingDoubleKeyFrame.EasingFunction>                            <CircleEase EasingMode="EaseIn"/>                          </EasingDoubleKeyFrame.EasingFunction>                        </EasingDoubleKeyFrame>                      </DoubleAnimationUsingKeyFrames>                      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" Storyboard.TargetName="Root">                        <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="0">                          <EasingDoubleKeyFrame.EasingFunction>                            <CircleEase EasingMode="EaseIn"/>                          </EasingDoubleKeyFrame.EasingFunction>                        </EasingDoubleKeyFrame>                      </DoubleAnimationUsingKeyFrames>                    </Storyboard>                  </VisualState>                </VisualStateGroup>              </VisualStateManager.VisualStateGroups>              <Grid.RowDefinitions>                <RowDefinition Height="2*"></RowDefinition>                <RowDefinition Height="*"></RowDefinition>              </Grid.RowDefinitions>              <Border Grid.Row="0" BorderBrush="Red" BorderThickness="0" CornerRadius="30">                <Border.Background>                  <ImageBrush ImageSource="images\baseUC\32.png" Viewport="0,0 1,1" ViewportUnits="Absolute" TileMode="FlipXY"></ImageBrush>                </Border.Background>                <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}"/>              </Border>              <Image Grid.Row="1" Source="images\baseUC\cor.png" VerticalAlignment="Top" HorizontalAlignment="Left"></Image>              <Path x:Name="BorderPath"/>              <!--Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding StrokeThickness}" StrokeLineJoin="Round"-->            </Grid>          </ControlTemplate>        </Setter.Value>      </Setter>    </Style>




使用:

<esri:InfoWindow x:Name="InfoWinMF"             Placement="TopRight"             Padding="15"               Map="{Binding ElementName=mainmap}"             ContentTemplate="{StaticResource GeneralDataTemplate}"             Style="{DynamicResource mainInfoWindowStyleMF}"             Width="1400"             Height="1000"      />

View Code