Unplanned
Last Updated: 15 Feb 2024 15:34 by Martin Ivanov
Martin Ivanov
Created on: 15 Feb 2024 15:34
Category: DataGrid
Type: Bug Report
0
DataGrid: The field filters in the popup filter control of DataGridNumericalColumn are limited between 0 and 100

The field filters in the DataGridNumericalFilterControl of DataGridNumericalColumn are using RadNumericBox controls for the input visuals. By default RadNumericBox is limited to values between 0 and 100, which means you cannot enter values outside of this range.

To work this around, you can re-template the DataGridNumericalFilterControl in order to set the Minimum and Maximum properties of the RadNumericBox element to NaN.

<Application
    x:Class="App3.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App3" xmlns:telerikDataGrid="using:Telerik.UI.Xaml.Controls.Grid.Primitives" xmlns:telerikInput="using:Telerik.UI.Xaml.Controls.Input">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
                <ResourceDictionary Source="ms-appx:///Telerik.WinUI.Controls/Themes/Generic.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <Style TargetType="telerikDataGrid:DataGridNumericalFilterControl">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="telerikDataGrid:DataGridNumericalFilterControl">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <ComboBox x:Name="PART_OperatorCombo"
                                          HorizontalAlignment="Stretch"
                                          ItemsSource="{Binding OperatorsList}"
                                          SelectedItem="{Binding FilterDescriptor.Operator, Mode=TwoWay, Converter={StaticResource FilterOperatorConverter}}"
                                          DisplayMemberPath="DisplayText">
                                </ComboBox>
                                <telerikInput:RadNumericBox x:Name="PART_ValueBox"
                                                            Minimum="NaN"
                                                            Maximum="NaN"
                                              HorizontalAlignment="Stretch"
                                              Value="{Binding FilterDescriptor.Value, Mode=TwoWay}"
                                              Grid.Row="1" Margin="0 10 0 0"/>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </Application.Resources>
</Application>

0 comments