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.

DataTemplate Column in GridDataControl

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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 01:14 PM

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 04:40 AM

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 11:38 AM

Ah, I like it. Nice and clean.

Thank you very much.

David Brenchley
Replied On March 4, 2010 04:26 PM

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 05:00 PM

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.

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.

;