大家好)我有下一个问题 - 我应该在listview中创建一些复选框列。但它不起作用,它显示为真或假。
private void CreateDataGridColumns()
{
var gridView = new GridView();
PlanningDataGrid.View = gridView;
gridView.Columns.Add(new GridViewColumn() {Header = "Тип мероприятия", DisplayMemberBinding = new Binding("Key")}); // Создаем первый столбец
var eventTypeList = GetEventTypesList();
foreach (string eventType in eventTypeList)
{
gridView.Columns.Add(new GridViewColumn() {Header = eventType, DisplayMemberBinding = new Binding("Value[" + eventType + "]"), CellTemplate = GenerateCellTemplate()});
}
}
private DataTemplate GenerateCellTemplate()
{
var template = new DataTemplate();
FrameworkElementFactory factory = new FrameworkElementFactory(typeof(CheckBox));
factory.SetBinding(CheckBox.IsCheckedProperty, new Binding());
template.VisualTree = factory;
return template;
}