2011-07-29 6 views
0

のスタイルを使用すると、私はGridViewの私は間違っていないよ場合にGridView

<Stylex:Key="{x:TypeCustom:DataGridRowHeader}"TargetType="{x:TypeCustom:DataGridRowHeader}"> 
<SetterProperty="Background"Value="{StaticResource RowHeaderBackgroundBrush}" />  
<SetterProperty="Template"> 
    <Setter.Value> 
     <ControlTemplate TargetType="{x:TypeCustom:DataGridRowHeader}"> 
      <Grid>      
       <Custom:DataGridHeaderBorder IsSelected="{TemplateBinding IsRowSelected}" 
          IsHovered ="{TemplateBinding IsMouseOver}" 
          IsPressed="{TemplateBinding IsPressed}" 
          BorderBrush="{Binding RelativeSource={RelativeSource AncestorType={x:Type Custom:DataGrid}}, 
           Path=HorizontalGridLinesBrush}" 
          Background="{TemplateBinding Background}"          
          BorderThickness="0,1,0,0" 
          Padding ="{TemplateBinding Padding}" 
          Orientation="Horizontal" 
          SeparatorVisibility="{TemplateBinding SeparatorVisibility}" 
          SeparatorBrush="{TemplateBinding SeparatorBrush}" Margin="0,-1,0,0"> 

        <StackPanel Orientation="Horizontal"> 
         <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
              VerticalAlignment="Center"/> 
         <Control SnapsToDevicePixels="false" 
        Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type Custom:DataGridRow}}, 
          Path=(Validation.HasError), 
        Converter={StaticResource bool2VisibilityConverter}}" 
        Template="{Binding RelativeSource={RelativeSource AncestorType={x:Type Custom:DataGridRow}}, 
          Path=ValidationErrorTemplate}" /> 
        </StackPanel> 
       </Custom:DataGridHeaderBorder> 
       <Thumb x:Name="PART_TopHeaderGripper" 
      VerticalAlignment="Top" Height="3" 
      Style="{StaticResource RowHeaderGripperStyle}"/> 
       <Thumb x:Name="PART_BottomHeaderGripper" 
      VerticalAlignment="Bottom" Height="3" 
      Style="{StaticResource RowHeaderGripperStyle}"/> 
      </Grid> 

      <ControlTemplate.Triggers>      
       <Trigger Property="IsMouseOver" Value="True"> 
        <Setter Property="Background" Value="{StaticResource RowHeaderIsMouseOverBrush}" /> 
       </Trigger> 
       <Trigger Property="IsRowSelected" Value="True"> 
        <Setter Property="Background" Value="{StaticResource RowBackgroundSelectedBrush}" /> 
       </Trigger> 
      </ControlTemplate.Triggers> 
     </ControlTemplate> 
    </Setter.Value> 
</Setter> 

答えて

0

ために、次のスタイルを使用するにはどうすればよい、何が必要グリッドビューに似たスタイルのヘッダです。私が必要とするものは、グリッドビューの列ヘッダースタイルです。そのためには、既存のxamlをそのまま使用し、x:TypeCustom:DataGridRowHeader to x:GridViewColumnHeaderのようなクラス名を変更することができます。

カスタム:DataGridHeaderBorderを通常のボーダーに変更します。以上です。 RowHeaderGripperStyleのようにあなたに言及した他のすべての静的リソースが得られたらと思います。ハッピーコーディング:)

関連する問題