WPF Grid column filter doesn't have startswith and contains when use AutoGenerateColumns

1 Answer 70 Views
GridView
Ken
Top achievements
Rank 1
Ken asked on 26 May 2023, 01:11 PM | edited on 29 May 2023, 12:49 AM

Sorry my bad English,

There is my RadGridView

<telerik:RadGridView x:Name="DepartmentBalanceListRadGridView"
                                     ItemsSource="{Binding Display}"
                                     IsBusy="{Binding IsBusy}"
                                     IsReadOnly="True"
                                     ScrollViewer.VerticalScrollBarVisibility="Visible"
                                     AutoGenerateColumns="True"
                                     RowHeight="50"
                                     SelectionMode="Extended"
                                     CanUserFreezeColumns="False"
                                     RowIndicatorVisibility="Collapsed"
                                     GroupRenderMode="Nested"
                                     AutoExpandGroups="True"
                                     HorizontalAlignment="Stretch"
                                     VerticalAlignment="Stretch"
                                     VerticalGridLinesBrush="LightGray"
                                     ShowGroupFooters="True"
                                     ShowColumnFooters="True"
                                     CanUserResizeColumns="True"
                                     CanUserGroupColumns="False"
                                     ColumnWidth="*"
                                     AutoGeneratingColumn="DepartmentBalanceListRadGridView_AutoGeneratingColumn">

            <telerik:RadGridView.ControlPanelItems>
                <telerik:ControlPanelItem ButtonTooltip="Filtering Options">
                    <telerik:ControlPanelItem.ButtonContent>
                        <Button Background="Transparent">

                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <cal:ActionMessage MethodName="PrintDepartmentBalance">
                                        <cal:Parameter Value="{Binding ElementName=DepartmentBalanceListRadGridView, Path=Items}"/>
                                        <cal:Parameter Value="{Binding ElementName=DepartmentBalanceListRadGridView, Path=SelectedItems}"/>
                                    </cal:ActionMessage>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>

                            <materialDesign:PackIcon Kind="Printer" Foreground="White" />

                        </Button>
                    </telerik:ControlPanelItem.ButtonContent>
                </telerik:ControlPanelItem>

            </telerik:RadGridView.ControlPanelItems>

            <telerik:RadGridView.Columns>

                <telerik:GridViewSelectColumn/>

            </telerik:RadGridView.Columns>

        </telerik:RadGridView>


Binding Display


private ObservableCollection<IDictionary<string, object>> _display;

public ObservableCollection<IDictionary<string, object>> Display
{
    get { return _display; }
    set
    {
         _display = value;
         NotifyOfPropertyChange(() => Display);
    }
}

now only 4 options 
is equal to, is not equal to, is null, is not null 

how can I add startswith and contains filter in the FilterControl ?

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 31 May 2023, 11:53 AM

Hello Ken,

The described options are available only in columns showing System.String objects. To show the needed options, you can change your numeric type to be a string. If this is not suitable for you, you will need to create a custom filtering control and implement whatever filtering you need there from scratch.

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
GridView
Asked by
Ken
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or