We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

dynamic ExpandoObject in binded items with autogeneratedcolumns

Thread ID:

Created:

Updated:

Platform:

Replies:

127667 Dec 1,2016 01:18 PM UTC Dec 2,2016 11:58 AM UTC WPF 1
loading
Tags: SfDataGrid
Leclerc Alexandre
Asked On December 1, 2016 01:18 PM UTC

Hello Syncfusion,

Here there is my situation, I have one SfDataGrid bind to a GridViewModel class (who is generic <T>) who set an ObsvervableCollection binded to his ItemCollection.
For one model object I need to add N-columns in terms of his related childs.

Here there is how I tried to do it, I parsed my collection, and for each related child, I create a dynamic object with ExpandoObject. When parse is done, I add it to an ObsvervableCollection who is copied in the binded ItemCollection.

Like this :

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var result = await this.Service.GetLstRemoteTAsync(userId);
var s       = new ObservableCollection<object>();

foreach (var benefit in (IEnumerable<Benefit>)result)
{
    dynamic service    = new ExpandoObject();
    service.Contexts   = string.Join(", ", benefit.Contexts);
    service.Code        = benefit.Code;
    service.BarCode   = benefit.BarCode;
    service.Vat           = 0.0;
    service.SubFamily = benefit.SubFamily;
   
    foreach (var modifier in benefit.Modifiers)
    {
        ExpandoHelper.AddProperty(
            service,
            "Modifier" + benefit.Modifiers.IndexOf(modifier),
            modifier);
    }

    s.Add(service)
}

this.Items = s;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

However, when it comes to generate column, the base objects displays correctly but when he arrives to complex objects he doesnt go through the method (AutoGeneratedColumn).

How can I do for display these columns ?

Thx, Alex.


Jai Ganesh S [Syncfusion]
Replied On December 2, 2016 11:58 AM UTC

Hi Leclerc, 
 
We have checked your query and currently we don’t have a support to Autogenerate the complex properties. We have already logged the feature report for this. This feature will be available in any of our upcoming release. Until then you can manually add the complex property columns instead of Autogenerating the columns.   
 
Regards, 
Jai Ganesh S 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;