2016-04-07 24 views
2
私は私のアプリでMahAppsライブラリを使用してい

、データグリッドセルのデフォルトのスタイルは、任意の境界を持っていないMahApps DataGridCellスタイル

<Style TargetType="{x:Type DataGridCell}"> 
    <Setter Property="Height" 
      Value="33" /> 
    <Setter Property="Background" 
      Value="Transparent" /> 
    <Setter Property="Padding" 
      Value="5,0" /> 
    <Setter Property="Template"> 
     <Setter.Value> 
      <ControlTemplate TargetType="{x:Type DataGridCell}"> 
       <Border x:Name="border" 
         Background="Transparent" 
         BorderBrush="Black" 
         BorderThickness="1" 
         Padding="0,10,0,10" 
         SnapsToDevicePixels="True"> 
        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> 
       </Border> 
      </ControlTemplate> 
     </Setter.Value> 
    </Setter> 
    <Setter Property="Template"> 
     <Setter.Value> 
      <ControlTemplate TargetType="{x:Type DataGridCell}"> 
       <Grid Background="{TemplateBinding Background}"> 
        <ContentPresenter VerticalAlignment="Center" /> 
       </Grid> 
      </ControlTemplate> 
     </Setter.Value> 
    </Setter> 
</Style> 

Data Grid Cells wit borders

は、だから私は、使用を開始しました、私は

答えて

2

DataGrid制御に GridLinesVisibility="All"を設定し...ヘルプMathAppsチームが、なしに助けを求めてきました

が、何も変化し、私は私が= {}属性に基づいて欠けていることを前提としていますが、私は見当もつかないそれ自体があなたに内境を与えるでしょう。

enter image description here

が、それはまだあなたの外枠を与えるものではありませんが、それは、デフォルトのテンプレートを編集するよりもはるかに簡単です。

実際に外枠を取得したい場合は、デフォルトのテンプレートを上書きする必要があります。

あなたが使用する必要がありますので、MahAppsデフォルトDataGridCellテンプレートキーは、MetroDataGridCellある<Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MetroDataGridCell}">

関連する問題