我的DataGrid
定义如下:
private void CreateSemanticChannels()
{
myGrid.Style = (Style)FindResource("MyDataGrid");
var col1 = new DataGridTextColumn
{
Header = "FUNCTIONALITY",
Binding = new Binding("Functionality"),
};
myGrid.Columns.Add(col1);
var col2 = new DataGridTextColumn
{
Header = "ASSOCIATED TO",
Binding = new Binding("AssociatedTo"),
FontWeight = FontWeights.SemiBold
};
myGrid.Columns.Add(col2);
DataTemplate buttonTemplate = new DataTemplate();
FrameworkElementFactory buttonFactory = new FrameworkElementFactory(typeof(Button));
buttonTemplate.VisualTree = buttonFactory;
var col3 = new DataGridTemplateColumn
{
Header = "STATUS",
CellTemplate = buttonTemplate
};
myGrid.Columns.Add(col3);
// AGGIORNAMENTO CONTENUTO E VISUALIZZAZIONE
UpdateGrid();
myGrid.SelectedIndex = -1;
advSettingGrid.Children.Add(myGrid);
}
UpdateGrid
中的哪个位置我将该项添加到DataGrid。
myGrid.Items.Add(newRecord)
;
我想修改每个Style
的{{1}},因此我开始关注此Same height of logo and navbar,但我始终Button
为空。
我看了post,实际上我忘了设置ItemSource
属性。所以我将对象的ItemSource
定义为List
,并在XAML中添加了此属性
_recordList
但是,我仍然将ItemSource清空。
任何帮助都非常感谢!