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

seamless input from InsertionRow

Sort Posts: Previous Next
  •  04-25-2008, 12:56 PM Post no. 11752

    seamless input from InsertionRow

    Is there a way to enter data in the InsertionRow , tab through the columns, press enter and have the first column ready to receive user input?

    Now after you prees the return key a new InsertionRow is displayed but the first column is not in edit mode.

  •  04-25-2008, 5:55 PM Post no. 11763 in reply to 11752

    Re: seamless input from InsertionRow

    You could derive from InsertionRow and override OnPreviewKeyDown like this:

        protected override void OnPreviewKeyDown( KeyEventArgs e )
        {
          base.OnPreviewKeyDown( e );

          if( e.Key == Key.Enter  )
          {       
            this.Cells[ 0 ].BeginEdit();   
          }
        }

     


    Technical Writer - Xceed Software

    Of all the things I've lost, I miss my mind the most. - Mark Twain
    Filed under:
  •  04-28-2008, 3:00 PM Post no. 11811 in reply to 11763

    Re: seamless input from InsertionRow

    I tried your suggestion and I'm see the same behavior if I did not add the code. I did set a breakpoint and I'm in the code.

    What I'm seeing is when I press the enter button the contents of the insertion row is shifted down into the next row and the insertion row is blank. The far left is showing ">" if I mouse click another cell and then click on the first cell of the insertion row then I'm in edit mode far left showing pencil. What I'm looking for is after I press the return key the first cell is in focus and in insert mode - I can continue typing with changing focus on the cell

     

     

  •  04-28-2008, 3:26 PM Post no. 11815 in reply to 11811

    Re: seamless input from InsertionRow

    You should also set the grid's EditTriggers property to CellIsCurrent | BeginEditCommand | ActivationGesture and the CellEditorDisplayConditions property to CellIsCurrent.

    Sorry about that!


    Technical Writer - Xceed Software

    Of all the things I've lost, I miss my mind the most. - Mark Twain
  •  04-28-2008, 5:03 PM Post no. 11820 in reply to 11815

    Re: seamless input from InsertionRow

    That worked thanks

    two questions 1 - how do you set the first cell as BeginEdit when the datagrid is initially displayed?

    2 - when I clear my screen I set dataviev binded to the datagrid  to dataview[xxx].Table.Clear(). Besides clearing the entered data it also clears the insertionrow from the gridcontrol. Is there a way to not delete the insertionrow or redisplay it after the clear? 

     

     

  •  04-28-2008, 5:21 PM Post no. 11821 in reply to 11820

    Re: seamless input from InsertionRow

    If you are referring to the first cell in the InsertionRow, then you will need to handle its Loaded event, preserve a reference to it and then access its Cells collection to place the first cell in edit mode.

    If you are referring to the first cell in the first datarow, then you will need to use the GetContainerFromItem method to retrieve the Xceed.Wpf.DataGrid.DataRow container and access its Cells collection (in the same manner as the InsertionRow). 

    As for clearing the grid, I suggest that rather than clearing the data view that you set the ItemsSource property to null. You will also need to clear the grid's collection of columns if the next source you are binding too does not have the same fields/columns.

    Besides clearing the entered data it also clears the insertionrow from the gridcontrol. Is there a way to not delete the insertionrow or redisplay it after the clear?

    If the column definitions are still present, then the InsertionRow should remain; you may just need to set the Height property to see it. 

     


    Technical Writer - Xceed Software

    Of all the things I've lost, I miss my mind the most. - Mark Twain
    Filed under:
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.