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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Example of Problem with Binding to User Control

Thread ID:





123719 Apr 13,2016 11:18 PM UTC Apr 14,2016 12:41 PM UTC UWP 1
Tags: SfDataGrid
Deanna Delapasse
Asked On April 13, 2016 11:18 PM UTC

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.


Attachment: UserControlBindingProblem_394ef88b.zip

Jayapradha S [Syncfusion]
Replied On April 14, 2016 12:41 PM UTC

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.



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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