2015-05-06 34 views
0

希望有人能幫助解決這個問題。我有一個WPF數據網格(見下面的代碼)。正如你所看到的,我已經將GridLinesVisibility設置爲垂直,但是可以看到水平網格線(請參見下面的圖片;我需要擺脫細的水平黃線)。我創建了一個簡單的WPF數據網格,然後將GridLinesVisibility設置爲Vertical,並且不顯示horizo​​ntalgridlines。所以我不確定是什麼導致了Horizo​​ntalGridLines顯示。任何想法如何我可以擺脫他們?不幸的是,我需要爲整個Grid設置RowBackground顏色,然後根據顯示的數據爲列設置行背景。刪除WPF數據網格中的Horizo​​ntalGridLines

Screenshot of my Grid. I need to get rid of the thin horizontal yellow lines

<DataGrid TabIndex="8" x:Name="fg" Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="4" Margin="5" RowHeaderWidth="0" ContextMenu="{StaticResource menuContext}" 
       ItemsSource="{Binding AssetPPM2GridEntityCollection}" ColumnHeaderStyle="{StaticResource ColumnContextMenus}" HeadersVisibility="{Binding HeaderVisibility}" 
       SelectedIndex="{Binding GrdFgSelectedIndex}" AutoGenerateColumns="False" SelectionUnit="FullRow" SelectionMode="Extended" 
       EnableRowVirtualization="True" EnableColumnVirtualization="False" RowBackground="PapayaWhip" 
       VirtualizingPanel.VirtualizationMode="Standard" CanUserReorderColumns="False" 
       CanUserAddRows="False" GridLinesVisibility="Vertical" CanUserSortColumns="True" CanUserResizeColumns="False"     
       dp:DataGridMergeCellBehavior.IsMerged="{Binding Source={StaticResource assetPPM2ViewModel}, Path=IsMergeCellsChecked}" 
       PreviewMouseWheel="fg_PreviewMouseWheel"> 
+0

這看起來不像網格線。因爲這與其他單元格上的背景顏色相同,所以我打賭的是網格單元格內容的一些填充/邊距 – dkozl

+0

設置'GridLinesVisibility =「垂直」'應該有所訣竅。檢查是否將單元格設置爲具有邊框樣式。 –

+0

非常感謝Anand,你的建議是檢查周圍邊界的樣式,這有助於我得出解決方案。 –

回答

0

的線條是由邊界引起的被加入到細胞中。邊界引起了移動,使行的背景顏色可見。解決方法是將邊距移回幾個像素。