We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Filter function

Hi,

I used Syncfusion wpf grid version 8.304.0.21.
There are 2 queston.

1. Are FilterPane window location movement possible?
Filter panel become pop-up inside Grid. So hides a contents.
2. I want to use CollectonVew Filter.
I want input receiving from different text box.


public string SearchText
{
set
{
CollectionView collectionView = this.DataGrid.ItemsSource as CollectionView;
if (collectionView == null) return;

collectionView.Filter = (item) =>
{
if (item as ViewModel == null) // data class
return false;

ViewModel vm = (ViewModel)item;
if (vm as ViewModel == null)
return false;

if (vm.Name.ToLower().Contains(value.ToLower()))
{
return true;
}
return false;
};

this.OnPropertyChanged("SearchText");
}

filter is not but i don't know a cause.

5 Replies

JJ Jeraldes J Syncfusion Team August 25, 2010 01:42 PM UTC

Hi

Thank you for your interest in Syncfusion products.

Question #1:

We have developed in the way the filter is set to be placed in the right as default manner. This is done in the code processing itself.

Question #2:

You have to place this code in the ItemsSourceChanged event. Then only the collection will be checked in that by using the Model.View you can set the values to the filter.

Let us know if you need any other details.

Regards,
Jeraldes J


JP jungjin Park. August 26, 2010 05:24 AM UTC

Hi.

Thanks for your reply.
My Code is changed.

public string SearchTextRPTID
{
set
{
ICollectionViewAdv collectionView = this.DataGridRPTID.Model.View;
if (collectionView == null) return;

collectionView.Filter = (item) =>
{

if (item as RPTIDViewModel == null)
return false;

RPTIDViewModel vm = (RPTIDViewModel)item;
if (vm as RPTIDViewModel == null)
return false;

if (vm.RPTID.ToString().Contains(value))
return true;

return false;
};

this.OnPropertyChanged("SearchTextRPTID");
}

}
The once operates well.
But frequently occurs error.
Error :
System.NullReferenceException occurs from DataGridRPTID.Model.GridVisualStyle.

What is problem??





SyncfusionGrid_error_93e4b166.zip


JJ Jeraldes J Syncfusion Team August 31, 2010 12:36 PM UTC

Hi,

You have to set this code in the Model.Initialized event in the grid. This is due to the datas to be initialized after that only the filter part will be set. If you try to do this before the data initialized, the styles will not be set.

This would solve you issue. If not could you please provide us with a sample to reproduce the issue.

Let us know if you need any other details.

Regards,
Jeraldes J


JP jungjin Park. September 6, 2010 05:06 AM UTC

Hello,

I modified code the Model.Initialized in the grid.
I try to do this after the data initialized.
The after problem is solved.

Thank you.




JJ Jeraldes J Syncfusion Team September 7, 2010 04:02 AM UTC

Hi Park,

Thank you for you responce.

Let us know if you need any other details.

Regards,
Jeraldes J



Loader.
Live Chat Icon For mobile
Up arrow icon