BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
I need to create columns at runtime. The requirements are that at runtime we don’t know how many columns we will have. For this we used either a dictionary or an ExpandoObject, which implements the IDictionary interface internally, with no success.
Although
the data is visible using the MappingName, we cannot use the default sorting and
grouping from the DataGrid.
Mapping
using the Dictionary approach (where index 0 resembles an ID field):
grdTest.Columns.Add(new
GridTextColumn() { Width = 150, HeaderText = "ID", MappingName =
"Properties[0]" });
or using
the ExpandoObject approach:
grdTest.Columns.Add(new GridTextColumn() { Width = 150, HeaderText = "ID", MappingName = "ID" });
We get the
following exception when we click on a header to sort the grid.
System.ArgumentException
at
System.Linq.Expressions.Expression.PropertyOrField(Expression expression,
String propertyOrFieldName)
at
Syncfusion.Linq.QueryableExtensions.GetValueExpression(ParameterExpression
paramExpression, String propertyName, Type sourceType)
at
Syncfusion.Linq.QueryableExtensions.GetLambdaWithComplexPropertyNullCheck(IQueryable
source, String propertyName, ParameterExpression paramExpression)
at
Syncfusion.Linq.QueryableExtensions.OrderBy(IQueryable source, String
propertyName, Type sourceType)
at
Syncfusion.WinRT.Data.QueryableCollectionView.SortQueryable(IQueryable source)
at Syncfusion.WinRT.Data.QueryableCollectionView.RefreshSort()
at
Syncfusion.WinRT.Data.CollectionViewAdv.EndDeferInternal()
at
Syncfusion.WinRT.Data.CollectionViewAdv.EndDefer()
at
Syncfusion.WinRT.Data.CollectionViewAdv.DeferHelper.Dispose()
at Syncfusion.WinRT.Data.CollectionViewAdv.EndInit()
at
Syncfusion.UI.Xaml.Grid.GridModel.MakeSort(GridColumn Column, ListSortDirection
direction)
at
Syncfusion.UI.Xaml.Grid.GridHeaderCellControl.Sort()
at
Syncfusion.UI.Xaml.Grid.GridHeaderCellControl.OnTapped(TappedRoutedEventArgs e)
Hi Marco,
Sorry for this inconvenience caused.
As of now we have not provided support for dynamic objects. We have planned to implement the Dynamic Object support in our next release, our next release will be available in middle of May 2013.
This exception occurs since we are using reflection to get the value from the objects that are bound to the DataGrid. In your case, by using the reflection we are not able to get the value from the Dynamic Objects (ExpandoObject). So, while clicking the column header DataGrid will throw the exception. Currently to avoid that exception, you can disable the sorting and grouping option in DataGrid.
Please let us know if you need further assistance.
Regards,
Prakash S.
We are glad to announce that our Essential Studio Vol 2 2013 is rolled out and is available for download under the following link
Please find the release notes in the following link
https://s3.amazonaws.com/files2.syncfusion.com/Installs/v11.2.0.25/ReleaseNotes/WinRT.html
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.
Regards,
Prakash S.
Hi Marco,
Sorry for the inconvenience caused.
We have analyzed the reported issue with
our sample; we are not able to reproduce the issue. Could you please check the
below sample?
Sample: http://www.syncfusion.com/downloads/Support/DirectTrac/91540/SampleTest822887180.zip
We suspect you are using our grid in
some other scenario, could you please modify our sample and revert with the
replication procedure, which would be very helpful to resolve the issue.
Please let us know if you have any
concerns.
Thank you,
Dineshprabhu V
Hi,
I managed to recreate my problem with your application. (see attachment)
The main difference is that you declare the columns in xaml, where I create them in codebehind (depending on the number (and names) of properties of the dynamic object. That's also the reason why I need a dynamic object, because I don't know how many properties there will be and what the names of those properties will be...
br,
Marco
Hi Marco,
Sorry for the inconvenience caused.
We have considered the reported problem
as a defect in our source and a fix for this defect will be included in the upcoming
service pack which will be available in next week.
Please let us know if you have any
concerns.
Thank you,
Dineshprabhu v
Hi Marco,
Sankar