WPF:DataGrid文本被下面的行切断

时间:2015-12-04 07:37:12

标签: c# wpf xaml datagrid

正如您在下面的图片中看到的那样,文字和图像正在被剪切。此外,您可以看到我们可以使用的文本上方还有一些空间。我们怎样才能将文本上移一点,以免它被削减。

我对WPF很新,请对我宽容。

以下是datagird xaml:

<DataGrid Grid.Row="0" Margin="30" Name="scanStatusGrid" AutoGenerateColumns="False" RowHeight="50" GridLinesVisibility="None">
            <DataGrid.Resources>
                <Style TargetType="{x:Type DataGridColumnHeader}">
                    <Setter Property="Background" Value="#626464" />
                    <Setter Property="Foreground" Value="White"/>
                    <Setter Property="FontSize" Value="14"/>
                    <Setter Property="Height" Value="30"/>
                    <Setter Property="FontFamily" Value="/TechHeal.Presentation.UINEW;component/Fonts/#Open Sans"/>

                </Style>
                <Style TargetType="{x:Type DataGrid}">
                    <Setter Property="Background" Value="White" />
                    <Setter Property="AlternationCount" Value="2" />
                </Style>

                <Style TargetType="{x:Type DataGridRow}">
                    <Style.Triggers>
                        <Trigger Property="ItemsControl.AlternationIndex" Value="0">
                            <Setter Property="Background" Value="White"></Setter>
                            <Setter Property="Height" Value="25"/>
                        </Trigger>
                        <Trigger Property="ItemsControl.AlternationIndex" Value="1">
                            <Setter Property="Background" Value="#e3f4f8"></Setter>
                            <Setter Property="Height" Value="25"/>
                        </Trigger>
                    </Style.Triggers>
                </Style>

                <Style TargetType="DataGridCell">
                    <Setter Property="Height" Value="25"/>
                    <Setter Property="HorizontalAlignment" Value="Center"/>
                    <Setter Property="VerticalAlignment" Value="Center"></Setter>
                    </Style>

            </DataGrid.Resources>

            <DataGrid.Columns>

                <DataGridTemplateColumn Header="Status" Width="200">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Image Source="{Binding imagestat}"  Height="20" Width="20"/>
                        </DataTemplate>

                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

                <DataGridTextColumn Header="Issue" Width="200" Binding="{Binding errorCount}">
                </DataGridTextColumn>
                <DataGridTextColumn Header="Scan Items" Width="*" Binding="{Binding scanName}">

                </DataGridTextColumn>
            </DataGrid.Columns>
        </DataGrid>        

enter image description here

0 个答案:

没有答案