User (Old forums)MemberMay 29, 2007 at 10:40 pmPost count: 23064
We have a weird problem that we can’t pinpoint sort of to do with filtering stuff in the datagrid.
Preliminary info is that we have the datagrid itemsource set to a collection view, which encloses a data view etc. The dataview has a row filter which is changed according to various choices made by the user.
The problem is that after certain filtering operations, one line shown in the datagrid will be incorrect. The data behind the faulty line will be correct however. eg. when the user selects the faulty line, we use that selection to display a picture, and the correct picture is always displayed.
The really weird conditions that produce the fault are as follows. Select a name to filter on. Select a different name to filter on, one that produces less than half as many filter results (half as many things showing up in the datagrid as the result of the filter) as the previous selection. Select a differnt person again to filter on, one with more than half as many filter results. And the faulty entry shows up – it displays the data that appeared in the middle entry of the first filter in the appropriate slot in the grid, rather than what is supposed to be there.
eg. Filter on person 1 has 11 responses. That works fine. Filter on person 2 produces 5 responses. That’s fine. Filter on person 3 has 9 responses. line 6 in the datagrid at this stage is line 6 from the first person.
If you filter on person 1 then person 3, it works fine.
There might be other problems too, but this is a fairly obvious, simple and consistent process and result.
This is a totally bizzarre problem.
We tried version 1.1 to see if it fixed anything and the filtering is a total mess – I didn’t fully analyse the pattern like with the previous one, but about half of filters done by just randomly clicking on people in the list produced responses in the data grid that were about half wrong. Much much worse.
Has anyone seen anything like this? Is it a datagrid problem? Does anyone have any good ideas?
Imported from legacy forums. Posted by Marie (had 4431 views)Xceed SupportMemberMay 30, 2007 at 8:52 amPost count: 5658
Are you using the DataGridCollectionView or the standard CollectionView? You seem to be using the RowFilter property of the standard CollectionView; however, I would like confirmation before proceeding.
In addition, could you provide me with a code snippet that demonstrates what you are doing?
Imported from legacy forums. Posted by Jenny [Xceed] (had 334 views)User (Old forums)MemberMay 30, 2007 at 11:12 pmPost count: 23064
when initialising page the datagrid is on:
DataView dataviewMyWizards = new DataView();
CollectionView cvMyWizards = new CollectionView(dataviewMyWizards); //to prevent sorting
On load of the page:
dataviewMyWizards.Table = tempptrwindow.fullDataSet.Tables;
dataviewMyWizards.RowFilter = filterOwned;
datagridMyWizards.ItemsSource = cvMyWizards;
After some kind of filtering stuff:
dataviewMyWizards.RowFilter = filterForMyWizards;
I think that’s pretty much all that happens to them. We have two datagrids, one with additional filtering, but both exhibit the same or similar problems.
We’re using the collectionView because that was stated somewhere in these forums as the way to prevent sorting by the user on the datagrid – and it worked quickly and easily which was great.
We don’t really want to update to the next version at the moment unless it solves our problem in a mind-bogglingly simple manner. As we have already tried simply upgrading to see what happens and seeing that it is ten times worse, it probably won’t be that easy!
Imported from legacy forums. Posted by Marie (had 426 views)Xceed SupportMemberMay 31, 2007 at 9:45 amPost count: 5658
We prone the use of the DataGridCollectionView[Source] classes rather than the CollectionView[Source] classes provided by the framework. This classes enhances grouping, sorting (which we will display through the ColumnManagerRow), and filtering. However, I did try using the CollectionView and the RowFilter property and did not experience any problems with the filtering. Could you tell us what your underlying datasource is? I tested with the Orders table of the Northwind database and filtered on the ShipCountry field.
Returning to the DataGridCollectionView (available free-of-charge in version 1.1)…
In XAML, using the DataGridCollectionViewSource class, filtering is done using the Filter event (refer to the Filtering Data topic in the documentation for an example).
In code, you need to use the Filter predicate delegate as demonstrated below. It might seem a little “complicated” as we need to deal with the FrameworkElementFactory class to access a ColumnManagerRow and set its AllowSort property false (I have put in a request to expose CanSort, CanFilter, and CanGroup properties directly on the DataGridCollectionView). In XAML, this is much “simpler” but since you sent your example in code, I assumed you were not using XAML.
protected override void OnInitialized( EventArgs e )
base.OnInitialized( e );
m_view = new DataGridCollectionView( App.Orders.DefaultView );
m_view.Filter = new Predicate<object>( this.ShipViaFilter );
DataGridControl grid = new DataGridControl();
TableView tableView = new TableView();
grid.View = tableView;
DataTemplate template = new DataTemplate();
template.VisualTree = new FrameworkElementFactory( typeof( ColumnManagerRow ) );
template.VisualTree.SetValue( ColumnManagerRow.AllowSortProperty, false );
grid.View.FixedHeaders.Add( template );
grid.ItemsSource = m_view;
this.Content = grid;
private bool ShipViaFilter( object value )
System.Data.DataRow row = value as System.Data.DataRow;
if( row != null )
if( ( row[ “ShipVia” ] != null ) && ( row[ “ShipVia” ] != DBNull.Value ) )
if( ( int )row[ “ShipVia” ] == 3 )
Imported from legacy forums. Posted by Jenny [Xceed] (had 438 views)User (Old forums)MemberMay 31, 2007 at 10:24 pmPost count: 23064
I haven’t looked at the rest of your post yet, but the data source is just a DataTable in a DataSet and we create columns and rows and fill them with information from an array – so, no database or anything like that. Once the dataset and everything is created at the startup of the program, it is not modified I don’t think unless it is entirely reloaded. Usually it just sits there and serves as a source for the grid and we filter it.
Imported from legacy forums. Posted by Marie (had 411 views)User (Old forums)MemberJune 6, 2007 at 12:27 amPost count: 23064
Hi, I haven’t managed to get it working with v1.1 yet – none of the data shows up in the datagrid, it all seems to be invisible. There is a thread just started about this by someone else, but there doesn’t seem to be any solution yet.
I have not yet solved the problem in v1.0 either.
however I just thought I’d add that in the following piece of code, the DataRowView contains all the right data, regardless of the fact that at the same time, incorrect data is being displayed visually in the datagrid.
public void datagrid_SelectedItemChanged(Object sender, EventArgs e)
DataGridControl dg = sender as DataGridControl;
if (dg.SelectedItem == null)
DataRowView drv = dg.SelectedItem as DataRowView;
Furthermore, the datagrid does not refresh when the underlying data table changes. But it does if one filters it for something different and then refilters back to the thing that changed – ie. after the filters, it has refreshed to reflect the data table changes. Trying to reapply the existing filter does not change anything. datagrid.Items.Refresh() also does not make any difference.
Imported from legacy forums. Posted by Marie (had 500 views)User (Old forums)MemberJune 6, 2007 at 2:18 amPost count: 23064
thats exactly the problem im facing .. i already sent a repro-app to the xceed staff (didnt get an answer so far)
ill let you know as soon as i get a solution or workaround for this
Imported from legacy forums. Posted by Benno (had 5510 views)
- You must be logged in to reply to this topic.