[英]MahApps DataGridCell style
我在我的應用程序中使用MahApps庫,默認樣式的datagrid單元格沒有邊框:
但我希望DataGrid看起來像這樣:
所以我開始:
<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>
但沒有任何變化,因此我假設我缺少基於[=}屬性,但是我不知道如何,我已經尋求幫助MathApps團隊,但沒有幫助...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.