Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
360
How to clear / delete value from ComboBoxItemsProvider
posted

I am trying to work out a way to delete / clear / set null a cell once it has had a value selected by the combo box selector.

Is there any built in behaviors that will let me do this. Currently once I have something selected it is impossible to set it back to empty

 

thanks for your suggestions

regards

Murray

 

  • 7305
    Suggested Answer
    posted

    I wanted to follow up and see if this approach addressed your question.

    Sam

  • 7305
    Suggested Answer
    posted

    Hello Murray,

    You can handle SelectedItemChanged event of XamComboEditor, then retrieve the active record, and use CellValuePresenter object for a given cell and set it like this:

    privatevoid xamCombo1_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)

    {

     

     

    DataRecord dr = xamDataGrid1.ActiveRecord as DataRecord;

     

    if (dr != null) CellValuePresenter cell = CellValuePresenter.FromCell(dr.Cells["your cell"

     

    {

     

    ]);

    cell.IsEnabled =

     

    false; 

     

    // Or

     

    cell.Visibility =

     

    Visibility.Hidden;

      }

    }

    Sam