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.

Customizing Rowheader

Thread ID:

Created:

Updated:

Platform:

Replies:

101209 Oct 6,2011 06:16 PM Jan 6,2012 08:32 AM WPF 3
loading
Tags: GridControl
Mrudang Majmudar
Asked On October 6, 2011 06:16 PM

How to customize row header.
I tried giving doing this
if (e.Cell.ColumnIndex == 0 &&
e.Cell.RowIndex != 0 &&
e.Cell.RowIndex != (gridDataControl1.Model.RowCount - 1))
{
e.Style.CellValue = e.Cell.RowIndex;
e.Style.CellType = "DataBoundTemplate";


e.Style.CellItemTemplateKey = RowHeaderTemplateKey";

}

how ever after is sort or select a row template effects are gone.

please advise.

thanks



Rajasekar [Syncfusion]
Replied On October 14, 2011 09:51 AM

Hi Mrudang,

Thanks for your update, You can able to prevent this behavior by setting those properties in PrepareRenderCell event instead QueryCellInfo event like below,

Code Snippet[C#]

this.dataGrid.ShowAddNewRow = false;
this.dataGrid.ShowRowHeader = true;
this.dataGrid.ModelLoaded += new EventHandler(dataGrid_ModelLoaded);

void dataGrid_ModelLoaded(object sender, EventArgs e)
{
this.dataGrid.Model.Grid.PrepareRenderCell += new Syncfusion.Windows.Controls.Grid.GridPrepareRenderCellEventHandler(Grid_PrepareRenderCell);
}

void Grid_PrepareRenderCell(object sender, Syncfusion.Windows.Controls.Grid.GridPrepareRenderCellEventArgs e)
{
if (e.Cell.ColumnIndex == 0 && e.Cell.RowIndex > 0)
{
e.Style.CellValue = e.Cell.RowIndex;
e.Style.CellType = "DataBoundTemplate";
e.Style.CellItemTemplateKey = "rowHeaderTemplate";
}
}

Please find the sample in the below location,

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

Please let us know if you have any queries.

Thanks,
Rajasekar



Mrudang Majmudar
Replied On October 14, 2011 07:59 PM

Thanks Rajasekar for reply.

now my template changes sticks.
but have different issue.

row header is of fixed size .
It does not grow based on the value of cell.

if row index > 4 digits or so it gets clipped.




Rajasekar [Syncfusion]
Replied On January 6, 2012 08:32 AM

Hi Mrudang,

Sorry for the delay in getting back to you.

You can achieve this requirement by using the below code snippet,

this.dataGrid.ModelLoaded += new EventHandler(dataGrid_ModelLoaded);

void dataGrid_ModelLoaded(object sender, EventArgs e)
{
this.dataGrid.Model.ResizeColumnsToFit(GridRangeInfo.Table(), GridResizeToFitOptions.None);
}

Please find the modified sample in the below location,

Modified Sample:

http://www.syncfusion.com/downloads/Support/DirectTrac/88940/SyncWPFRowHeaderTemplate-1057648007.zip

Please let us know if you have any queries.

Thanks,
Rajasekar



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.

;