我正在使用SyncFusion GridDataControl
来显示一些数据。
网格中的行分组在一列(例如列Group
)
当列Group
具有特定值(即null
或""
)时,我不想使用组,因此行将始终显示且无法折叠。
有没有人知道如何做到这一点?
到目前为止,我已经联系到Loaded
上的GridDataControl
事件:
private void OnGridLoaded(object sender, RoutedEventArgs e)
{
foreach ( Group group in AttributeGrid.Model.View.Groups)
{
if (@group.Key == null)
{
AttributeGrid.Model.Table.ExpandGroup(@group);
// Do something here to hide the group?
}
}
}
答案 0 :(得分:2)
请查看以下更新
//Use the below code to Expand the particular group based on the key
void AssociatedObject_Loaded(object sender, RoutedEventArgs e)
{
foreach (Group group in this.AssociatedObject.Model.View.Groups)
{
if (group.Key.Equals(1))
this.AssociatedObject.Model.Table.ExpandGroup(group);
}
}
对于在运行时折叠组,
//Use the below code to cancel the Grouping for particular group based on the keu
void Table_GroupCollapsing(object sender, GroupCollapsingEventArgs args)
{
if (args.Group.Key.Equals(1))
args.Cancel = true;
}