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

DataTemplate Column in GridDataControl

Thread ID:

Created:

Updated:

Platform:

Replies:

93164 Feb 26,2010 10:55 PM UTC Mar 17,2010 09:00 PM UTC WPF 5
loading
Tags: GridControl
David Brenchley
Asked On February 26, 2010 10:55 PM UTC

I have followed your example for setting a datatemplate in a column of the grid.

void Model_QueryCellInfo(object sender, Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventArgs e) {
if (e.Cell.RowIndex > 0 && e.Cell.ColumnIndex == 5) {
e.Style.CellType = "DataTemplate";
//e.Style.CellTemplateKey = "editableEmployee";
//e.Style.CellValue = employeesSource.Employees[e.Cell.RowIndex % employeesSource.Employees.Count];
//e.Style.Background = Brushes.Linen;

}
}

This works fine, except when the user changes the position of the columns. How do we resolve that issue?

I think a more elegant solution (for future grids) might be something like this.





David Brenchley
Replied On March 2, 2010 06:14 PM UTC

The solution I have come up with is the following.

void Model_QueryCellInfo(object sender, Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventArgs e) {
if (e.Cell.ColumnIndex > 0 && e.Cell.RowIndex > 0
&& TicketGrid.VisibleColumns[e.Cell.ColumnIndex - 1].MappingName == "AssignedUsers"
) {
e.Style.CellType = "DataTemplate";
}
}

Ganesan K [Syncfusion]
Replied On March 3, 2010 09:40 AM UTC

Hi David,

Thanks for using Syncfusion products.

You can use the following code to achieve your requirement







Please let us know if you need any more details.

Thanks
Ganesan

David Brenchley
Replied On March 4, 2010 04:38 PM UTC

Ah, I like it. Nice and clean.

Thank you very much.

David Brenchley
Replied On March 4, 2010 09:26 PM UTC

This code does not work. It just shows is:

CellType = "DataTemplate" CellValue=








If it helps, here is my datatemplate















Text="{Binding UserName}"/>










Ganesan K [Syncfusion]
Replied On March 17, 2010 09:00 PM UTC

Hi David,

Thanks for the update,

The following sample illustrates the use of data-bound templates with the Grid Data Control. Could you please verify?

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=CS2415316.zip

Please let us know if you need any more details.

Thanks
Ganesan

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.

Please sign in to access our forum

or the page will be automatically redirected to 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

;