表格基本接口完成

This commit is contained in:
2025-09-01 17:12:06 +08:00
parent 6ccc323bb2
commit 29e6225cdc
251 changed files with 1671 additions and 92 deletions

View File

@@ -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)