1

我正在使用SyncFusion GridDataControl来显示一些数据。

网格中的行按列分组(例如 column Group

Group当列具有特定值(即nullor )时,我不想使用组,""因此行将始终显示并且无法折叠。

有谁知道如何做到这一点?

到目前为止,我已经参与了以下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?
        }
    }
}
4

1 回答 1

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;
}
于 2012-11-29T07:37:49.543 回答