I'd like to show some (but not all) data in DataGrid filled with List of RowValues:
public class RowValue
{
public int id;
public string name;
public List<A> list1;
public List<B> list2;
}
public class A
{
public int id;
public string val1;
public string val2;
...
}
public class B
{
public int id;
public string val1;
public string val2;
...
}
When I expand a row in Master-Detail DataGrid I see two cards showing rows for each list (list1 and list2). I'd like to hide list1 from viewing in my DataGrid. At the moment I can hide all columns in list1 but an empty card with the header is still polluting the GridView.
void gridView_MasterRowExpand(object sender, CustomMasterRowEventArgs e)
{
var masterView = sender as GridView;
GridView detailView = masterView?.GetDetailView(e.RowHandle, e.RelationIndex) as GridView;
if(detailView == null) return;
//disabling Columns
if(detailView.LevelName == "list1")
foreach(var column in detailView.Columns)
column.Visible = false;
}
To illustrate my problem I attach picture with card that have removed all columns.
I successfully manage to complete this task. The easiest in my opinion answer is to set e.IsEmpty Arg to true in MasterRowEmpty event. See code bellow:
void gridView_MasterRowEmpty(object sender, MasterRowEmptyEventArgs e)
{
GridView view = sender as GridView;
if(view.GetRelationName(e.RowHandle, e.RelationIndex) == "list1") // == "Card Name"
e.IsEmpty = true;
}