表格基本接口完成
This commit is contained in:
@@ -40,47 +40,26 @@ namespace template
|
||||
DebugBar(Debugtag, $"未指定操作目标", 警告橙色);
|
||||
}
|
||||
|
||||
xDataGrid.AddColumn("标题", ColumnType.Label);
|
||||
xDataGrid.AddColumn("判断", ColumnType.CheckBox);
|
||||
xDataGrid.AddColumn("康波", ColumnType.ComboBox);
|
||||
xDataGrid.InitColumns(
|
||||
("标题", ColumnType.Label),
|
||||
("判断", ColumnType.CheckBox),
|
||||
("康波", ColumnType.ComboBox)
|
||||
);
|
||||
|
||||
xDataGrid.Rows.Add(
|
||||
new Dictionary<string, Dictionary<string, object>?> {
|
||||
{
|
||||
"标题", new Dictionary<string, object> {
|
||||
{ "Content", "你妈妈" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"判断", new Dictionary<string, object> {
|
||||
{ "IsChecked", true }
|
||||
}
|
||||
},
|
||||
{
|
||||
"康波", new Dictionary<string, object> {
|
||||
{ "ItemsSource", new List<string>{"你妈","日你"} },
|
||||
{ "SelectedValue","日你"}
|
||||
}
|
||||
}
|
||||
});
|
||||
(xDataGrid.AddRow()["标题"] as Label).Content = "1";
|
||||
(xDataGrid.AddRow()["标题"] as Label).Content = "2";
|
||||
(xDataGrid.AddRow()["标题"] as Label).Content = "3";
|
||||
|
||||
xDataGrid.AddRow()["标题"]["Content"] = "2";
|
||||
xDataGrid.AddRow()["标题"]["Content"] = "3";
|
||||
|
||||
|
||||
|
||||
// 修改按钮文本
|
||||
// 查找Content为"删除"的第一行
|
||||
/*
|
||||
var targetRow = xDataGrid.Rows.FirstOrDefault(row =>
|
||||
row.ContainsKey("Content") && row["Content"]?.ToString() == "他妈");
|
||||
|
||||
if (targetRow != null)
|
||||
{
|
||||
targetRow["IsChecked"] = true;
|
||||
targetRow["SelectedValue"] = "新值";
|
||||
}
|
||||
*/
|
||||
var targetRow = xDataGrid.Rows
|
||||
.FirstOrDefault(row => (row["标题"] as Label)?.Content.ToString() == "2");
|
||||
|
||||
(targetRow["判断"] as CheckBox).IsChecked= true;
|
||||
|
||||
}
|
||||
#endregion
|
||||
@@ -148,7 +127,7 @@ namespace template
|
||||
|
||||
private void 删(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
xDataGrid.Rows.Clear();
|
||||
}
|
||||
|
||||
private void 查(object sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user