Welcome to the Xceed Community | Help
Community Search  
More Search Options

Deselect Insertion Row / Cell

Sort Posts: Previous Next
  •  05-28-2012, 8:09 AM Post no. 32154

    Deselect Insertion Row / Cell

    Hello, I'm having a little issue with my datagrid. I have an insertion row with a combo box. It works fine.

    However, the source of this combo box may be changed depending of what the user does.

    If the user is selecting something in the combo box in insertion row and then do something that will change the combo box item source, if the combobox is selected in the insertion row, it will appear empty (just appear because if he clicks on the combobox the new items will drop down) when refreshed because the previous selected item is not in the combo box' new item source.

     The best way would be to re-initialize my insertion row when I want or to clear it. I looked a little and didn't figure how to do it.

    A nice work around would be to just deselect the cell in the insertion row. I looked in that direction too and didn't find anything either.

    A hint or an example for both solutions would be great.

    Thanks.

  •  05-30-2012, 4:51 PM Post no. 32188 in reply to 32154

    Re: Deselect Insertion Row / Cell

    Hi Jib,

    Here are 3 examples you can use, but before we start you will need a handle on your InsertionRow. You can do this in its Loaded event:

       private InsertionRow myInsertionRow;
       private void InsertionRow_Loaded(object sender, RoutedEventArgs e)
       {
          myInsertionRow = sender as InsertionRow;
       }


    1) Cancel the edit on the InsertionRow, and (optional) begin the edit again.

       if (myInsertionRow.IsBeingEdited)
       {
          myInsertionRow.CancelEdit();
          myInsertionRow.BeginEdit();
       }


    2) Force new values to all or some cells to 'reset' them.

       if (myInsertionRow.IsBeingEdited)
       {
          myInsertionRow.Cells["FirstName"].Content = "";
          myInsertionRow.Cells["LastName"].Content = "";
       }


    3) Force the focus to a specific cell (optional: only if the focus is currently on a specific cell)

       if (myInsertionRow.IsBeingEdited)
       {
          if(myInsertionRow.Cells["Department"].IsCurrent)
          {
             myInsertionRow.Cells["FirstName"].Focus();
          }
       }

     


    ** Quick Tip: Clients with an active support subscription should be sending their questions by email if they wish to benefit from the faster response time. Thanks!


    Diane Lafontaine
    Technical Support
    Xceed Software Inc.
  •  05-31-2012, 5:54 AM Post no. 32190 in reply to 32188

    Re: Deselect Insertion Row / Cell

    Thanks a lot Diane it works like a charm.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.