Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
520
change field layout setting from code behind for child object
posted

I have object like below

public class categories

{

public string CategoryName {get;set;}

public string DateCreated {get;set;}

public ObservableCollection <Product> products {get;set;}

}

public class Product

{

public string ProductName {get;set;}

public double PurchasedAmount {get;set;}

public double SalesAmount {get;set;}

}

on Xaml.cs

public Window1()

{

XamDataGrid1.DataSource= CreateCategoriesList();

}

public ObservableCollection <Category> CreateCategoriesList()

{

ObservableCollection <Category> _returnlist= new ObservableCollection <Category> ();

}

=== 

My requirement:

I want to show only ProdcutName and SalesAmount  on child row, hide Purchased amount from child row, but I want to do FieldLayoutSetting from code behind for child object, can anyone help me?

  • 138253
    Verified Answer
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I handled the XamDataGrid’s FieldLayoutInitialized event and in the handler I set the PurchasedAmount Field’s Visibility to Collapsed. Please let me know if this helps you or you need further assistance on this matter.

     

    Looking forward for your reply.

    FieldVisibility.zip