【问题标题】:Add margin to DataGridTextColumn向 DataGridTextColumn 添加边距
【发布时间】:2011-12-20 13:09:02
【问题描述】:

如何向 DataGridTextColumn 添加边距或内边距?

【问题讨论】:

    标签: wpf wpfdatagrid


    【解决方案1】:

    没有示例代码的答案不是很有帮助。使用这个:

    <DataGridTextColumn Header="Name" Binding="{Binding Name}">
        <DataGridTextColumn.ElementStyle>
            <Style TargetType="{x:Type TextBlock}">
                <Setter Property="Margin" Value="5" />
                <Setter Property="Padding" Value="10" />
            </Style>
        </DataGridTextColumn.ElementStyle>
    </DataGridTextColumn>
    

    x 前缀来自xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"。我使用了一个具有公共 Name 属性的业务对象。

    【讨论】:

      【解决方案2】:

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-01-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-10-09
        • 2015-08-14
        • 2015-06-25
        相关资源
        最近更新 更多