正如您所看到的,数据网格中最后一行的底部边框落在数据网格的边界附近并使其看起来很难看。我该如何解决这个问题?
<DataGrid HeadersVisibility="Column"
ItemsSource="{Binding Path=DevLengths}"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
CanUserReorderColumns="False"
CanUserResizeRows="False"
CanUserResizeColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="Size" Binding="{Binding Id}" IsReadOnly="True"/>
<DataGridTextColumn Header="Length of Splice" Binding="{Binding LengthOfSplice}"/>
<DataGridTextColumn Header="Length of Development" Binding="{Binding LengthOfDevelopment}"/>
<DataGridTextColumn Header="Ldh" Binding="{Binding Ldh}"/>
<DataGridTextColumn Header="Length of Hook" Binding="{Binding LengthOfHook}" Width="*">
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Margin" Value="0,0,-1,0"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
答案 0 :(得分:1)
您可以为 var JoinTest = (
from a in _db.Task.AsEnumerable()
join b in _db.Product on a.ProductId equals b.ProductId
select new TomFoolery.Models.ViewModel /* changed */
{
TaskId = a.TaskId,
TaskDesc = a.TaskDescription,
ProdDesc = b.ProductDescription
});
ViewData["CompositeData"] = JoinTest.ToList(); /*changed */
设置BorderThickness="1,1,1,0"
。这将删除底部边框并将顶部,左侧,右侧设置为默认值1。
所以你的新代码将是:
DataGrid