how to filter a column, if its cell is list

Hi,

i have an issue to filter column of SfDatagrid. The cells of this Column are lists. Could you help me? Thanks a lot!

Best regard,

Wenkai

3 Replies

DY Deivaselvan Y Syncfusion Team September 19, 2018 10:02 AM UTC

Hi Wenkai,

Thank you for contacting Syncfusion support.

We are unable to investigate on the reported issue with the given details and could you please provide the following details to us for proceeding to analyze further

1. XAML codes for SfDataGrid control
2. Code examples if you have done any customization with SfDataGrid
3. Model and ViewModel details which is bound with the SfDataGrid
4. Replication procedure for the UI interaction on the issue which you reproduced

We could analyze if you provide above requested details and update you with the appropriate solution at the earliest.

Note:
Refer the below documentation for more details on data binding and filtering concepts in SfDataGrid control.
https://help.syncfusion.com/wpf/sfdatagrid/data-binding
https://help.syncfusion.com/wpf/sfdatagrid/filtering
https://www.syncfusion.com/kb/wpf/sfdatagrid?sortId=0&tags=filtering

Regards,
Deivaselvan 



WW Wenkai Wang October 4, 2018 07:47 AM UTC

Hi Deivaselvan,

i have attached a file for you to analyze. Thank you.

Regards,

Wenkai

Attachment: Desktop_40035c69.7z


DY Deivaselvan Y Syncfusion Team October 8, 2018 11:36 AM UTC

Hi Wenkai,

Thanks for your update.

We have analyzed your query and you can achieve your requirement “To apply filter for listbox element in GridTemplateColumn” by using the below code snippets. Since, if we keep any of the Edit elements in the CellTemplate then it will break the virtualization behavior while scrolling the data and reusing the same row to populate another data. Thereby, we have used the TextBlock as a CellTemplate and loaded ListBox as an EditTemplate.
  
<Syncfusion:GridTemplateColumn MappingName="EmployeeName" FilterPopupStyle="{StaticResourcefilterControlStyle}">  
    <Syncfusion:GridTemplateColumn.CellTemplate>  
        <DataTemplate>  
            <TextBlock Text="{Binding EmployeeName, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>  
        </DataTemplate>  
    </Syncfusion:GridTemplateColumn.CellTemplate>  
    <Syncfusion:GridTemplateColumn.EditTemplate>  
        <DataTemplate>  
            <ListBox ItemsSource="{BindingDataContext.EmployeeList,ElementName=sfdatagrid,Mode=TwoWay}" SelectedValue="{Binding EmployeeName}">  
            </ListBox>  
        </DataTemplate>  
    </Syncfusion:GridTemplateColumn.EditTemplate>  
</Syncfusion:GridTemplateColumn>  

Please find the sample for the same from the below location. Try running this sample and let us know if this helps you.
http://www.syncfusion.com/downloads/support/directtrac/139886/ze/WPF540661317.zip

Regards,
Deivaselvan 


Loader.
Up arrow icon