DataGrid标题不需要的像素边框

时间:2015-12-05 15:15:43

标签: c# wpf datagrid

我有三个相同的桌子彼此相邻(原谅压痕):

<GroupBox Header = "reguliere buien" Grid.Row="0" Grid.Column="0">
    <DataGrid AutoGenerateColumns = "False" ItemsSource="{Binding Path=Static.BuienRegulier, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Style="{StaticResource GetalTabel}"
                CanUserResizeColumns="False" CanUserResizeRows="False" CanUserReorderColumns="False" CanUserSortColumns="False"
                FrozenColumnCount="2" IsReadOnly="True" ScrollViewer.VerticalScrollBarVisibility="Visible">
        <DataGrid.Columns>
            <DataGridTextColumn MinWidth = "25" Header="#" Binding="{Binding Path=Nummer}" HeaderStyle="{StaticResource NummerHeader}" CellStyle="{StaticResource NummerCell}"/>
            <DataGridTextColumn Width = "*" Header="omschrijving" Binding="{Binding Path=Omschrijving}" HeaderStyle="{StaticResource OmschrijvingHeader}" CellStyle="{StaticResource OmschrijvingCell}"/>
            <DataGridTextColumn MinWidth = "75" Header="neerslag&#x0a;(m&#xb3;)" Binding="{Binding Path=Neerslag}" HeaderStyle="{StaticResource NeerslagHeader}"/>
            <DataGridTextColumn MinWidth = "75" Header="duur&#x0a;(s)" Binding="{Binding Path=NatteTijd}"/>
        </DataGrid.Columns>
        <DataGrid.RowStyle>
            <Style TargetType = "{x:Type DataGridRow}" BasedOn="{StaticResource MetroDataGridRow}">
                <EventSetter Event = "MouseDoubleClick" Handler="SelecteerReguliereBui" />
            </Style>
        </DataGrid.RowStyle>
    </DataGrid>
</GroupBox>
<GroupBox Header = "extreme buien" Grid.Row="0" Grid.Column="1">
    <DataGrid AutoGenerateColumns = "False" ItemsSource="{Binding Path=Static.BuienExtreem}"
                HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Style="{StaticResource GetalTabel}"
                CanUserResizeColumns="False" CanUserResizeRows="False" CanUserReorderColumns="False" CanUserSortColumns="False"
                FrozenColumnCount="2" IsReadOnly="True" ScrollViewer.VerticalScrollBarVisibility="Visible">
        <DataGrid.Columns>
            <DataGridTextColumn MinWidth = "25" Header="#" Binding="{Binding Path=Nummer}" HeaderStyle="{StaticResource NummerHeader}" CellStyle="{StaticResource NummerCell}"/>
            <DataGridTextColumn Width = "*" Header="omschrijving" Binding="{Binding Path=Omschrijving}" HeaderStyle="{StaticResource OmschrijvingHeader}" CellStyle="{StaticResource OmschrijvingCell}"/>
            <DataGridTextColumn MinWidth = "75" Header="neerslag&#x0a;(m&#xb3;)" Binding="{Binding Path=Neerslag}" HeaderStyle="{StaticResource NeerslagHeader}"/>
            <DataGridTextColumn MinWidth = "75" Header="duur&#x0a;(s)" Binding="{Binding Path=NatteTijd}"/>
        </DataGrid.Columns>
        <DataGrid.RowStyle>
            <Style TargetType = "{x:Type DataGridRow}" BasedOn="{StaticResource MetroDataGridRow}">
                <EventSetter Event = "MouseDoubleClick" Handler="SelecteerExtremeBui" />
            </Style>
        </DataGrid.RowStyle>
    </DataGrid>
</GroupBox>
<GroupBox Header = "aangepaste buien" Grid.Row="0" Grid.Column="2">
    <DataGrid AutoGenerateColumns = "False" ItemsSource="{Binding Path=Static.BuienAangepast}"
                HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Style="{StaticResource GetalTabel}"
                CanUserResizeColumns="False" CanUserResizeRows="False" CanUserReorderColumns="False" CanUserSortColumns="False"
                FrozenColumnCount="2" IsReadOnly="True" ScrollViewer.VerticalScrollBarVisibility="Visible">
        <DataGrid.Columns>
            <DataGridTextColumn MinWidth = "25" Header="#" Binding="{Binding Path=Nummer}" HeaderStyle="{StaticResource NummerHeader}" CellStyle="{StaticResource NummerCell}"/>
            <DataGridTextColumn Width = "*" Header="omschrijving" Binding="{Binding Path=Omschrijving}" HeaderStyle="{StaticResource OmschrijvingHeader}" CellStyle="{StaticResource OmschrijvingCell}"/>
            <DataGridTextColumn MinWidth = "75" Header="neerslag&#x0a;(m&#xb3;)" Binding="{Binding Path=Neerslag}" HeaderStyle="{StaticResource NeerslagHeader}"/>
            <DataGridTextColumn MinWidth = "75" Header="duur&#x0a;(s)" Binding="{Binding Path=NatteTijd}"/>
        </DataGrid.Columns>
        <DataGrid.RowStyle>
            <Style TargetType = "{x:Type DataGridRow}" BasedOn="{StaticResource MetroDataGridRow}">
                <EventSetter Event = "MouseDoubleClick" Handler="SelecteerAangepasteBui" />
            </Style>
        </DataGrid.RowStyle>
    </DataGrid>
</GroupBox>

该风格基于MahApps Metro“MetroDataGrid”(mahapps.com)。它们呈现正常,除了其中一个表头中的以下奇怪边框:

whats going on

当我调整窗口大小时,边框会消失,我该如何解决这个烦恼?

0 个答案:

没有答案