2

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.

Empty card I wish to remove from view.

Piotr Wojcik
  • 95
  • 1
  • 17
  • Maybe you can add a [AppearanceAttribute](https://documentation.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.ConditionalAppearance.AppearanceAttribute.class) to `list1` to control its [Visibility](https://documentation.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.ConditionalAppearance.AppearanceAttribute.Visibility.property) and hide it. Another option would be an [AppearanceController](https://documentation.devexpress.com/eXpressAppFramework/113374/Task-Based-Help/Miscellaneous-UI-Customizations/How-to-Customize-the-Conditional-Appearance-Module-Behavior). Working? – ViRuSTriNiTy Jul 16 '18 at 15:20
  • It doesn't help. More info in my question update. – Piotr Wojcik Jul 17 '18 at 07:15
  • I'm quite surprised there appears to be no easy way to do this... – Hambone Jul 23 '18 at 02:27

1 Answers1

0

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;
}
Piotr Wojcik
  • 95
  • 1
  • 17