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.
Unfortunately, activation email could not send to your email. Please try again.

Example of Problem with Binding to User Control

Thread ID:

Created:

Updated:

Platform:

Replies:

123719 Apr 13,2016 07:18 PM Apr 14,2016 08:41 AM UWP 1
loading
Tags: SfDataGrid
Deanna Delapasse
Asked On April 13, 2016 07:18 PM


I've got a usercontrol (InspectionItemPresenter) configuration that I can not bind correctly to the SFDataGrid, but works with a ListView.  

I made a copy of my control (InspectionItemPresenter2) and modified it to accept the entire object instead of binding the parts separately and with that I can show data in my grid, but because of the way I had to set context (to make the grid data show) in the user control constructor my DataContext is the user control itself which is BAD...I need data in the grid AND  the InspectionItem object as the DataContext. 

Please run the example and see that the InspectionItems bind directly to the UserControl and  try to help me get the DataGrid to show this as well.  The current setup will throw a few exceptions (complaining about the DAtaContext being the wrong type), but you will be able to see the desired result in the ListView.

There are several extra files in the solution that can be ignored.  I'm pressed for time or I would have cleaned it up for you.  Sorry about the inconvenience.

thanks!
Deanna

Attachment: UserControlBindingProblem_394ef88b.zip

Jayapradha S [Syncfusion]
Replied On April 14, 2016 08:41 AM

Hi Deanna,

Thank you for contacting Syncfusion Support.

We have analyzed your reported issue with your sample. We found that you have used the different collection for SfDataGrid and ListView. In ListView, you have used PointDataSequential as ItemsSource and it is collection of InspectionItem. So that InspectionItemPresenter can get the required property values from InspectionItem class. But in the case of SfDataGrid Points2 is the itemssource which is the collection of PointTestClass. So the datagrid item template couldn’t get the required properties.

Please modify the SfDataGrid itemssource to PointDataSequential like list view. It is working fine.

Regards,
Jayapradha


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.

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.

;