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

Can you please put a sample of using cellitemtemplate with the silverlight grid

Thread ID:

Created:

Updated:

Platform:

Replies:

91166 Nov 6,2009 11:25 PM UTC Nov 25,2009 08:14 PM UTC Silverlight 9
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On November 6, 2009 11:25 PM UTC

Please give us a cellitemtemplate sample. It throws an exception when using regular Binding code.

Mohamed Suhaib Fahad A. [Syncfusion]
Replied On November 9, 2009 06:28 AM UTC

Hi,

We found one small bug with the DataTemplate renderer, this is fixed now in our latest trunk. The sample below includes the fix that allows using binding code in DataTemplates,

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

The binding code is as follows,

















The CellBoundValue is a wrapper instance that associates the underlying object and the grid style object. Let me know if this helps.

Thanks,
Fahad
Grid.Silverlight Team
Syncfusion Inc.,

Administrator [Syncfusion]
Replied On November 9, 2009 05:35 PM UTC

Thanks for your reply. I will try the same. Could you please provide some samples on changing control template of the row using styles?
I tried it but I was having problem in Setting the target type.


Mohamed Suhaib Fahad A. [Syncfusion]
Replied On November 10, 2009 04:51 AM UTC

Hi,

Thanks for the details. Right now, we don't have a row container kind of arrangement with the cells, So specifying styles for each row is not possible. We have this added in our log, and would work this out in our future releases.

You could however, try out using the Model.QueryCellInfo instead and design each cell.

Please let me know if this helps.

Thanks,
Fahad

Sanjay Choudhri
Replied On November 20, 2009 10:14 PM UTC

I want to add an unbound column to the grid and set the value of this column in code behind on QueryCellInfo event.

When I try to use:
this.grid.Model.Table.SetValue(e.Cell.RowIndex, "<>", <>);
It returns Expression has been evaluated and has no value.

I am using MappingName property in xaml to give the column name.


Second question: What is the recommended way to show data in columns if we want to use converters to show the data?

For e.g.: The grid is bound to the list of employees. The employee object has a managerId property. I want to display the name of the manager in one column and designation of the manager in the second column.

In this case, I want to use a converter to take the id and return value in column 1 and column 2.
I was able to do this by keeping the MappingName same for both columns and use Binding to call converters to return name and designation.
Is this correct?

If the MappingName is same, how can I group the data by using the above two columns? What should be the column names?


Sanjay Choudhri
Replied On November 21, 2009 12:00 AM UTC

Hi,

I verified that if converters are used for a gridviewcolumn, that column cannot be used for grouping. Is that correct?

What is the purpose of Converter in defining grouped column using GridDataGroupColumn?

Sanjay Choudhri
Replied On November 25, 2009 05:44 PM UTC

Hi,

Haven't received a reply from Syncfusion on my recent questions. Your reply is critical for us to progress with our prototype using Syncfusion grid.

Mohamed Suhaib Fahad A. [Syncfusion]
Replied On November 25, 2009 06:01 PM UTC

Hi,

We are sorry for the delay on this, I have a sample prepared that uses Model.QueryUnboundColumnValue to populate the unbound cells,

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

Regarding to the complex property binding + Grouping, we haven't completely ported the support for Grouping + Converters, this feature will be added up in our future releases. As of now, we don't have immediate plans on this.

Also, You could create a direct trac incident for quick follow ups. Please let me know if you need any more details.

Thanks,
Fahad

Sanjay Choudhri
Replied On November 25, 2009 06:58 PM UTC

Thanks.

I will try your solution in few minutes.

Can you please provide a quick reply on: Is there any way to change the style/look of the group header such that I can hide the +, - buttons, change the text on grouped row and make it center aligned?

Also how to change the fontsize of the grid. I tried changing the font size on the grid but it didn't change.

Mohamed Suhaib Fahad A. [Syncfusion]
Replied On November 25, 2009 08:14 PM UTC

Hi,

Yes, you can customize the each cell that is presented in the Grid. Use the QueryCellInfo event as follows,

model.QueryCellInfo += (s, e) =>
{
var gridStyleInfo = e.Style as GridDataStyleInfo;
var tableStyleInfoIdentity = gridStyleInfo.CellIdentity;
if (tableStyleInfoIdentity.TableCellType == GridDataTableCellType.GroupCaptionPlusMinusCell)
{
// user modified code here
}

e.Style.CellValue = string.Format("Cell {0} / {1}", e.Cell.RowIndex, e.Cell.ColumnIndex);
};

Like so we have different TableCellType enum values that you can check out and make changes to each cell style. This would be the most optimal way to deal with cell based styling.

To change the FontSize, right now we don't have the default binding done, but you can use the QueryBaseStyles,

this.dataGrid.Model.QueryBaseStyles += new GridQueryBaseStylesEventHandler(Model_QueryBaseStyles);

void Model_QueryBaseStyles(object sender, GridQueryBaseStylesEventArgs e)
{
if (e.Cell.RowIndex >= this.dataGrid.Model.HeaderRows && e.Cell.ColumnIndex >= this.dataGrid.Model.HeaderColumns)
{
e.BaseStyles.Add(new GridStyleInfo() { Font = new GridFontInfo() { FontFamily = new FontFamily("Calibri"), FontSize = 14d }, VerticalAlignment = VerticalAlignment.Center });
e.Handled = true;
}
}

Please let me know if you need any more details.

Thanks,
Fahad

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

;