This is a migrated thread and some comments may be shown as answers.

QueriableCollectionView Remove() method

1 Answer 63 Views
GridView
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 13 Jul 2011, 12:04 PM
Hello,
I am trying to use the QueriableCollectionView class for DataGrid databinding.
I have the folowing code on window loaded event:

private QueryableCollectionView _qcv; 
        private void WindowLoaded(object sender, RoutedEventArgs e)
        {
            _qcv =  new QueryableCollectionView(_entities.Countries);
            radGridView1.ItemsSource = _qcv;
            radDataForm1.ItemsSource = _qcv;
        }

then:

  private void ButtonDeleteClick(object sender, RoutedEventArgs e)
        {
            Country c = _qcv.CurrentItem as Country;
            _qcv.Remove(c);
        }

Can you tell me please why _qcv.Count remains the same? The item is not deleted? What am I doing wrong?Am i missing something?
Thank you very much.

PS: QueriableCollectionView.CanRemove returns false.

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 13 Jul 2011, 12:27 PM
Hi John,

This is most probably because the DataForm is in AutoEdit mode and while this is true, it holds the QCV locked, i.e. you can't add or remove stuff before the edit has finished. 

Is this the case?

Best wishes,
Ross
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
GridView
Asked by
John
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or