Exemple #1
0
        private void setConnection()
        {
            myDataGrid = new System.Windows.Controls.DataGrid();

            /* try
             * {
             *   SqlConnection thisConnection = new SqlConnection(@"Server=(LocalDb)\MSSQLLocalDB;Initial Catalog=test;Integrated Security=True;");
             *   thisConnection.Open();
             *
             *   string Get_Data = "SELECT * FROM cus";
             *
             *   SqlCommand cmd = thisConnection.CreateCommand();
             *   cmd.CommandText = Get_Data;
             *
             *   SqlDataAdapter sda = new SqlDataAdapter(cmd);
             *   DataTable dt = new DataTable("cus");
             *   sda.Fill(dt);
             *
             *   myDataGrid.ItemsSource = dt.DefaultView;
             * }
             * catch
             * {
             *   MessageBox.Show("db error");
             * }*/
        }
 public DataGridProxy(System.Windows.Controls.DataGrid dg) :
     base(dg)
 {
     dg.BeginningEdit        += new EventHandler <DataGridBeginningEditEventArgs>(dg_BeginningEdit);
     dg.RowEditEnding        += new EventHandler <DataGridRowEditEndingEventArgs>(dg_RowEditEnding);
     dg.LoadingRow           += new EventHandler <DataGridRowEventArgs>(dg_LoadingRow);
     dg.PreparingCellForEdit += new EventHandler <DataGridPreparingCellForEditEventArgs>(dg_PreparingCellForEdit);
 }