C1Datagrid for WPF FilterRow: Changing the default search mode

Posted by: christoph.schattka on 22 December 2021, 3:55 am EST

    • Post Options:
    • Link

    Posted 22 December 2021, 3:55 am EST

    Hello,

    I’m using an old componentone C1Datagrid for WPF in my project. The FilterRow search actually works as “Begin with”. My attached example works actually only for the FilterRow in that way (one of the Columns is “Störungskatalog” containing the String “Kollision” as example) : FIRST type into the Filter the characters “ko”-> Result after search only Datasets wich are including the String “Kollision”. SECOND type into the Filter the characters"ll"-> Result after search there are no Datasets.

    Now my question: Is it possible to change this search mode to “Contains” for all Columns?

    Many thanks for your support.

    Best Regards,

    Chris

    <c1grid:C1DataGrid x:Name="DG_Vorauswahl" Theme="{DynamicResource {c1grid:C1ThemeKey ThemeName=Vista, TypeInTargetAssembly={x:Type c1grid:C1DataGrid}}}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="551" Height="935"  Margin="10,64,0,0" NewRowPlacement="None" GroupByCaption="" GroupByVisibility="Collapsed" BorderThickness="2" Background="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"  AutoGenerateColumns="True"  AllowHierarchicalData="False" AllowHorizontalColumnSizing="False" AllowHorizontalSplit="False" AllowHorizontalSplitSizing="False" AllowVerticalSplit="False" AllowVerticalSplitSizing="False" SyncItemCellWidthToHeader="True"  AllowColumnMove="False" AllowDelete="False" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" ForceCursor="False" BorderBrush="#FF78879B" Foreground="WhiteSmoke">
                <c1grid:C1DataGrid.Columns>
                    <c1grid:Column  PropertyName="RLI-Nummer" HeaderCellWidth="115" HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}"/>
                    <c1grid:Column  PropertyName="Störungskatalog"  HeaderCellWidth="200" HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}" />
                    <c1grid:Column  PropertyName="Status"  HeaderCellWidth="120"  HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}" />
                    <c1grid:Column  PropertyName="Stillstand" HeaderCellWidth="85" HeaderCellContentTemplate="{StaticResource Grid_CLFont}">
                    <c1grid:Column.ItemCellShowContentTemplate>
                            <ControlTemplate>
                                <TextBlock Text="{Binding Value}" TextAlignment="Center" TextWrapping="Wrap" FontSize="14" Foreground="Black">
                                    <TextBlock.Style>
                                        <Style TargetType="{x:Type TextBlock}">
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding Value, ConverterParameter='J', Converter={StaticResource converter}}" Value="True">
                                                    <Setter Property="Background" Value="#FFFFA000" />
                                                    <Setter Property="FontWeight" Value="SemiBold" />
                                                    <Setter Property="TextAlignment" Value="Center" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </TextBlock.Style>
                                </TextBlock>
                            </ControlTemplate>
                        </c1grid:Column.ItemCellShowContentTemplate>
                        </c1grid:Column>
                    <c1grid:Column  PropertyName="Bis"   HeaderCellWidth="180" HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}" />
                    <c1grid:Column  PropertyName="Zugehörig"  HeaderCellWidth="170" HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}" />
                    <c1grid:Column  PropertyName="Nr"  HeaderCellWidth="100"  HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}" />
                    <c1grid:Column  PropertyName="Angelegt"  HeaderCellWidth="85"  HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}" />
                    <c1grid:Column  PropertyName="Meldung"  HeaderCellWidth="170" HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}" />
                    <c1grid:Column  PropertyName="Störungsbeschreibung"  HeaderCellWidth="170" HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}" />
                    <c1grid:Column  PropertyName="Melder"  HeaderCellWidth="100"  HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}" />
                    <c1grid:Column  PropertyName="info_03"  HeaderCellWidth="85"  HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}" />
                    <c1grid:Column  PropertyName="Standort"  HeaderCellWidth="85"  HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}" />
                    <c1grid:Column  PropertyName="Bezeichnung"  HeaderCellWidth="120"  HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}" />
                    <c1grid:Column  PropertyName="Anlagenart"  HeaderCellWidth="120"  HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}" />
                    <c1grid:Column  PropertyName="Zugewiesen"  HeaderCellWidth="110"  HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}" />
                    <c1grid:Column  PropertyName="Dokumentenpfad"  HeaderCellWidth="150"  HeaderCellContentTemplate="{StaticResource Grid_CLFont}" ItemCellShowContentTemplate="{StaticResource Grid_OLFont}" />
    
                </c1grid:C1DataGrid.Columns>
            </c1grid:C1DataGrid>
    ```[img]https://gccontent.blob.core.windows.net/forum-uploads/file-605209fc-1c80-4aee-9495-59124a94adfd.PNG[/img][img]https://gccontent.blob.core.windows.net/forum-uploads/file-0ae2adac-bd9d-45b2-ba44-83d9a6703a44.PNG[/img][img]https://gccontent.blob.core.windows.net/forum-uploads/file-6a8dd76f-5390-47fa-898f-bd8ab577e0c9.PNG[/img][img]https://gccontent.blob.core.windows.net/forum-uploads/file-b881e71b-54c4-480f-9b6d-6cdc3e69c11c.PNG[/img]
  • Posted 23 December 2021, 5:08 am EST

    Hi,

    Thanks for the code snippet and snapshots.

    The C1DataGrid build you are using is too old and it is not possible to implement your requirement in that build. JFYI, there have been many fixes/updates since then in C1DataGrid and your requirement is supported with the latest C1DataGrid. So, we would request to you upgrade to the latest C1 build.

    JFYR, this can be implemented with latest C1DataGrid by adding a DataGridFilterRow as follows:

    
    <c1:C1DataGrid x:Name="grid" >
           <c1:C1DataGrid.TopRows>
                <c1:DataGridFilterRow/>
           </c1:C1DataGrid.TopRows>
    </c1:C1DataGrid>
    
    

    Please refer the attached sample for the same : DatagridFilterRow.zip

    Best Regards,

    Nitin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels