【发布时间】:2014-01-17 15:05:38
【问题描述】:
我有一个DataGrid,即horizontally stretched,其中包含one column。问题是 DataGrid 被拉伸,但列保持不变。我怎样才能让它填充 DataGrid。一切都是动态完成的,如何用代码来完成。
var datagridDetails = new DataGrid
{
AutoGenerateColumns = false,
VerticalAlignment = VerticalAlignment.Top,
HorizontalAlignment = HorizontalAlignment.Stretch
};
var columnDetails = new DataGridTextColumn
{
Header = "Details",
CanUserSort = false,
CanUserResize = false,
Binding = new Binding("Details"),
Width = StackPanelContent.ActualWidth/2 - 8 //hacking through it but not working quite well
};
【问题讨论】: