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

Getting the grid to behave correctly with DataTemplates

Thread ID:





101103 Sep 27,2011 01:25 AM UTC Oct 31,2011 08:39 AM UTC WPF 1
Tags: GridControl
Michael Culley
Asked On September 27, 2011 01:25 AM UTC

When I started using the syncfusion grid I was happy to find that I could use it with DataTemplates but this soon turned to frustration when I realised it didn't really work that well with them. The main problem I found was that they had replaced the standard DataContext with "CellBoundValue" and that I had to use this everywhere. At first I didn't consider this to be much of an issue but it soon became apparent that this would mean I would need to define every template I use twice, once for the grid and once for everything else. I found a way to get around this which I think works fairly well but it is still a workaround that I feel should not be necessary. I've posted my solution below. My question is, is this the best way to do things? Am I missing something? Is there a simpler way?

For syncfusion staff, is there any plans to remove the need for this "CellBoundValue"?

I've attached a project for VS2010 that shows my solutions. The first is for when you need to use the default template for an object (see GridContentTemplate). The second is when you want to specify the template to use. In my example, the first column in the grid uses the default template for a Person object but the second column specifies a template. In both cases we avoid the need to litter our templates with references to CellBoundValue and can re-use the template elsewhere.


Ramesh V [Syncfusion]
Replied On October 31, 2011 08:39 AM UTC

Hi Michael,

Thanks for your patience.

We have analyzed your requirements with the given sample. And also we have modified your sample to implement the Data Template in a best way.

Please find the modified sample under the following location.

Sample: http://www.syncfusion.com/downloads/Support/DirectTrac/86651/SFGridTemplatesModified237070035.zip

Please let us know if you have any queries.



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