GridGroupingControl, change a text cell to progress bar
When I click on a button to do some work for a row in a GridGroupingControl, I would like to change a cell in that row to a progress bar. I do not seem to be able to fine out how to do this, any help would be appreciated.
Thanks,
Shawn.
Thanks,
Shawn.
SIGN IN To post a reply.
3 Replies
JJ
Jisha Joy
Syncfusion Team
September 3, 2010 10:28 AM UTC
Hi,
You can handle PrepareViewStyleInfo event of the GridGrouping Control and set the celltype as progressbar.
Here is the code:
Here is the sample:
http://www.syncfusion.com/support/user/uploads/GGCProgressBar_135a40c4.zip
Please let me know if this helps.
Regards,
Jisha
You can handle PrepareViewStyleInfo event of the GridGrouping Control and set the celltype as progressbar.
Here is the code:
this.gridGroupingControl1.TableControl.PrepareViewStyleInfo += new Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventHandler(TableControl_PrepareViewStyleInfo);
void TableControl_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
if (e.RowIndex == 7 && e.ColIndex == 2)
{
e.Style.CellType = "ProgressBar";
}
}
Here is the sample:
http://www.syncfusion.com/support/user/uploads/GGCProgressBar_135a40c4.zip
Please let me know if this helps.
Regards,
Jisha
SB
Shawn Benson
September 3, 2010 04:23 PM UTC
Thanks for the help. If works, but when I try to update/animate the progress bar it is not working. It still is coming through as a sting when I grab the style, not a progress bar. sample is below.
private void buttonAdv1_Click_1(object sender, EventArgs e)
{
Animate(true);
}
System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
void Animate(bool enabled)
{
if (enabled)
{
timer.Tick += new EventHandler(timer_Tick);
timer.Interval = 10;
timer.Enabled = true;
timer.Start();
}
else
{
timer.Tick -= new EventHandler(timer_Tick);
timer.Stop();
}
}
private void timer_Tick(object sender, EventArgs e)
{
Record r = this.gridGroupingControl1.Table.CurrentRecord;
this.gridGroupingControl1.BeginUpdate();
GridTableCellStyleInfo stylev = this.gridGroupingControl1.Table.GetTableCellStyle(r, "ProcessStatus");
GridProgressBarInfo progressBarExv = stylev.ProgressBar;
int pvaluev = (progressBarExv.ProgressValue + 3) % 100;
progressBarExv.ProgressValue = pvaluev;
gridGroupingControl1.EndUpdate(true);
Application.DoEvents();
}
private void buttonAdv1_Click_1(object sender, EventArgs e)
{
Animate(true);
}
System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
void Animate(bool enabled)
{
if (enabled)
{
timer.Tick += new EventHandler(timer_Tick);
timer.Interval = 10;
timer.Enabled = true;
timer.Start();
}
else
{
timer.Tick -= new EventHandler(timer_Tick);
timer.Stop();
}
}
private void timer_Tick(object sender, EventArgs e)
{
Record r = this.gridGroupingControl1.Table.CurrentRecord;
this.gridGroupingControl1.BeginUpdate();
GridTableCellStyleInfo stylev = this.gridGroupingControl1.Table.GetTableCellStyle(r, "ProcessStatus");
GridProgressBarInfo progressBarExv = stylev.ProgressBar;
int pvaluev = (progressBarExv.ProgressValue + 3) % 100;
progressBarExv.ProgressValue = pvaluev;
gridGroupingControl1.EndUpdate(true);
Application.DoEvents();
}
JJ
Jisha Joy
Syncfusion Team
September 6, 2010 09:26 AM UTC
Hi Shawn,
Please see the following sample that shows animated progressbar in grid cells.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=sampl122052282261.zip
Regards,
Jisha
Please see the following sample that shows animated progressbar in grid cells.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=sampl122052282261.zip
Regards,
Jisha
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
SB Shawn Benson
- Sep 2, 2010 07:47 PM UTC
- Sep 6, 2010 09:26 AM UTC