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.
Unfortunately, activation email could not send to your email. Please try again.

SfDataGrid - Cannot add filter

Thread ID:

Created:

Updated:

Platform:

Replies:

121352 Dec 4,2015 08:28 AM Dec 4,2015 03:24 PM WPF 1
loading
Tags: SfDataGrid
James Randle
Asked On December 4, 2015 08:28 AM

Hi,
I'm using the SfDataGrid inside a TabControlEx. When the SfDataGrid is in the first TabItemEx, I can use the Window.Loaded event to set SfDataGrid.ItemsSource and SfDataGrid.View.Filter.

When i place the SfDataGrid into the second TabItemEx, SfDataGrid.View == null during Windows.Loaded and so i cannot set SfDataGrid.View.Filter.

I have attached a project that illustrates the issue.

Many Thanks,
James.

Attachment: sfdatagridAndTabControlEx_c1d57e47.rar

Sivakumar R [Syncfusion]
Replied On December 4, 2015 03:24 PM

Hi James,

You can set the View.Filter  by handling ItemsSourceChanged event. Find the code snippet and modified sample below,

sfDataGridA.ItemsSourceChanged += sfDataGridA_ItemsSourceChanged;
sfDataGridB.ItemsSourceChanged += sfDataGridB_ItemsSourceChanged;

void sfDataGridB_ItemsSourceChanged(object sender, Syncfusion.UI.Xaml.Grid.GridItemsSourceChangedEventArgs e)

{

    if (sfDataGridB.View != null)

        sfDataGridB.View.Filter = Filter;

}


void sfDataGridA_ItemsSourceChanged(object sender, Syncfusion.UI.Xaml.Grid.GridItemsSourceChangedEventArgs e)

{

    if (sfDataGridA.View != null)

        sfDataGridA.View.Filter = Filter;
}


Sample:
http://www.syncfusion.com/downloads/support/forum/121352/ze/sfdatagridAndTabControlEx-1067328435

Thanks,
Sivakumar

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;