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.


Thread ID:





102999 Mar 21,2012 04:59 PM Mar 22,2012 09:56 AM WPF 1
Tags: GridControl
Andrew Rosenblum
Asked On March 21, 2012 04:59 PM

Can a DataTemplateSelector be used in wpf GridDataControl? Anyone have sample code for this?

Alternately, is there a way to set the Data Template programmatically, something like:

private void Model_QueryCellInfo(object sender_, GridQueryCellInfoEventArgs e_)
if (e_.Style.CellValue is TwoDecimalNumber)
var o = TryFindResource("TwoDecimalNumber");
e_.Style.CellItemTemplate = o as DataTemplate;

This sets the DataTemplate but it is not used.

Soundara Pandian S [Syncfusion]
Replied On March 22, 2012 09:56 AM

Hi Andrew ,

We have analyzed your queries and you can achieve your requirements by using the following code changes.

Code Snippet(XAML):

Code Snippet(C#):
void Model_QueryCellInfo(object sender, Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventArgs e)
this.GDC.Model[2, 2].CellType = "DataBoundTemplate";
this.GDC.Model[2, 2].CellItemTemplateKey = "temp1";

Please let us know if you have any queries.

Soundara Pandian S


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.