Welcome to the Xceed Community Sign in | Join | Help
Community Search  

After Adding New row to datagrid, row is selected but focus not set to first column

Sort Posts: Previous Next
  •  09-06-2008, 1:17 AM Post no. 14963

    After Adding New row to datagrid, row is selected but focus not set to first column

    Hi,

    i have call dataGridControl.BringIntoView()  after add new row to datagrid

    now call

    Xceed.Wpf.DataGrid.DataRow row = gvTrnDtlOUT.GetContainerFromItem(gvTrnDtlOUT.CurrentItem) as Xceed.Wpf.DataGrid.DataRow;

    if (row != null)

    {

    Xceed.Wpf.DataGrid.Cell cell = row.Cells[0];

    if (cell != null)

    {

    cell.BeginEdit();

    }

    }

    but still focus not set to first column of newly added row of grid.

    Sir Please Explain With example i m very new to xceed.

    My code Snipest is here afetr add new row to datatable which is binded to grid so one row added to grid accordingly:

    if (e.Key == Key.Down && (MainPage.mainPage.currentMode == CurrentMode.EditMode || MainPage.mainPage.currentMode == CurrentMode.NewRecordMode))

    {

    gvTrnDtlOUT.BringIntoView();

    Xceed.Wpf.DataGrid.DataRow row = gvTrnDtlOUT.GetContainerFromItem(gvTrnDtlOUT.CurrentItem) as Xceed.Wpf.DataGrid.DataRow;

    if (row != null)

    {

    Xceed.Wpf.DataGrid.Cell cell = row.Cells[0];

    if (cell != null)

    {

    cell.BeginEdit();

    }

    }

    }

     

    Thanks 

    Yagnesh Kachhadia

  •  09-08-2008, 8:41 AM Post no. 14990 in reply to 14963

    Re: After Adding New row to datagrid, row is selected but focus not set to first column

    You should be using BringItemIntoView rather than BringIntoView. Once that is done, you can call BeginEdit on the grid, which will place the current item in edit mode.
    Technical Writer - Xceed Software

    Of all the things I've lost, I miss my mind the most. - Mark Twain
  •  10-21-2008, 8:16 AM Post no. 16267 in reply to 14990

    Re: After Adding New row to datagrid, row is selected but focus not set to first column

    Thanks Buddy,,,,

     

    I Have Solved This By Using  ur Reply Like This. 

     

    System.Data.DataRowView rv = grid.Items[grid.Items.Count - 1] as DataRowView;

                            if (rv != null)

                            {

                                grid.CurrentItem = rv;

                                grid.BringItemIntoView(rv);


                            } 

     

    Thanks Jenny. 

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.