Blog Of Sem: Devexpress gridview Dinamik Satır Ekleme (sil butonuyla)

Devexpress gridview Dinamik Satır Ekleme (sil butonuyla)

Bir tane devexpress gridview yarat ve kodlar aşağıda

using DevExpress.XtraEditors.Repository;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TIPEXE
{
    public partial class Form1 : Form
    {
        public class BILGILER
        {

            public BILGILER()
            {
            }

            public string BARKOD { get; set; }
            public string ADI { get; set; }
            public string SİL { get; set; }

        }
        public BindingList<BILGILER> _Grid_data;
        public Form1()
        {
            InitializeComponent();

        }
        private void button3_Click(object sender, EventArgs e)
        {
            _Grid_data.Add(new BILGILER()
            {
                BARKOD = "asd",
                ADI = "assaas"
            });
            RepositoryItemButtonEdit SILDUGMESI = new RepositoryItemButtonEdit();
            SILDUGMESI.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;
            SILDUGMESI.Buttons[0].Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph;
            SILDUGMESI.Buttons[0].Image = Bitmap.FromFile("resimler\\simgeler\\SIL.png");
            SILDUGMESI.Buttons[0].Caption = "SİL";
            SILDUGMESI.ButtonClick += SILDUGMESI_ButtonClick;
            gridControl1.RepositoryItems.Add(SILDUGMESI);
            gridView1.Columns["SİL"].ColumnEdit = SILDUGMESI;
        }
        private void SILDUGMESI_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            gridView1.DeleteSelectedRows();
        }
        private void bunifuFlatButton3_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2();
            form2.Show();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            _Grid_data = new BindingList<BILGILER>();
            gridControl1.DataSource = _Grid_data;
            gridView1.PopulateColumns();
            //bunifuFlatButton4.BackColor = Color.Teal;
            //bunifuFlatButton4.Activecolor = Color.Teal;
        }
    }
}