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

DataTemplateSelector

Thread ID:

Created:

Updated:

Platform:

Replies:

102999 Mar 21,2012 08:59 PM UTC Mar 22,2012 01:56 PM UTC WPF 1
loading
Tags: GridControl
Andrew Rosenblum
Asked On March 21, 2012 08:59 PM UTC

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 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





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.

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

;