I want below.
enter image description here
I want to add a button to the last row of gridview.
Is it possible?
I have done this using footer.
public static void CustomDrawFooter(DevExpress.XtraGrid.GridControl gridControl, GridView gridView)
{
gridView.OptionsView.ShowFooter = true;
gridView.FooterPanelHeight = 40;
// Handle this event to paint the footer panel manually
gridView.CustomDrawFooter += (s, e) => {
int Hoffset = 10;
int Voffset = 5;
e.DefaultDraw();
markRectangle = new Rectangle(e.Bounds.X + Hoffset, e.Bounds.Y + Voffset, e.Bounds.Width - 2 * Hoffset, e.Bounds.Height - 2 * Voffset);
e.Appearance.BackColor = Color.White;
e.Appearance.FillRectangle(e.Cache, e.Bounds);
e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
e.Appearance.ForeColor = Color.White;
e.Appearance.FontSizeDelta = 1;
e.Appearance.Font = new Font("Segoe UI Semibold", 10);
e.Appearance.Options.UseTextOptions = true;
e.Cache.FillRectangle(new SolidBrush(Color.FromArgb(184, 169, 126)), markRectangle);
e.Appearance.DrawString(e.Cache, "Show more items...", markRectangle);
};
}
I added MouseUp Event.
private void GridView_MouseUp(object sender, MouseEventArgs e)
{
GridHitInfo hitInfo = dmGridView.CalcHitInfo(e.Location);
if(hitInfo.HitTest == GridHitTest.Footer)
{
if ((e.Location.X >= markRectangle.X && e.Location.X <= markRectangle.X + markRectangle.Width) &&
(e.Location.Y >= markRectangle.Y && e.Location.Y <= markRectangle.Y + markRectangle.Height))
MessageBox.Show("HAHAHAHAHAH");
}
}
This works.