Customizing Rowheader
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
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
SIGN IN To post a reply.
3 Replies
RA
Rajasekar
Syncfusion Team
October 14, 2011 01:51 PM UTC
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
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
MM
Mrudang Majmudar
October 14, 2011 11:59 PM UTC
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.
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.
RA
Rajasekar
Syncfusion Team
January 6, 2012 01:32 PM UTC
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
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
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
MM Mrudang Majmudar
- Oct 6, 2011 10:16 PM UTC
- Jan 6, 2012 01:32 PM UTC