DataTemplateSelector

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.


1 Reply

SP Soundara Pandian S Syncfusion Team March 22, 2012 01:56 PM UTC

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.


Thanks,
Soundara Pandian S





Loader.
Up arrow icon