![](/img/trans.png)
[英]Figuring out how to get rid of border around cell in UITableView cell
[英]How to get rid of border in datagrid cell content?
我正在使用常規的 WPF 數據網格。 我想擺脫單元格中項目周圍的惱人邊框。 我應該使用哪個屬性來刪除它?
我實際上是使用 celltemplate 在列中設置相同的行為。
[煩人的邊框] https://i.ibb.co/ryxTfYB/anoyingborder.png
<DataGrid.Columns>
<DataGridTemplateColumn Header="Field" Width="130" >
<DataGridTemplateColumn.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="KeyboardNavigation.IsTabStop" Value="False"/>
</Style>
</DataGridTemplateColumn.CellStyle>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="FieldType" IsEditable="True"
ItemsSource="{Binding FieldTypeComboList, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
DisplayMemberPath="Value"
SelectedItem="{Binding Type, Mode=TwoWay}"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
IsTextSearchEnabled="True"
MaxDropDownHeight="300">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel VirtualizingPanel.IsVirtualizing="True" IsItemsHost="True"/>
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
嘗試在組合框上設置BorderThickness="0"
並將組合框高度與單元格高度相匹配
Height="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGridCell}, Path=ActualHeight}"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.