This is a migrated thread and some comments may be shown as answers.

Filter indicator has disappeared

7 Answers 546 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 25 Jun 2012, 11:35 AM

Hello Telerik,

    A while back I threw together a basic GridView theme for use by my company... The problem is that I originally removed the ability to use the built in filter control and now I cannot remember what I removed from the structure.

I have located the 'PART_DistinctFilterControl' control's code, which seems fine, but I cannot find anything else that would prevent the filter indicator from showing... Unless I have completely removed the button's code!

Can you help me put the pieces back together?

7 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 25 Jun 2012, 11:51 AM
Hello Adam,

 


Have you predefined the template of GridViewHeaderCell? Generally you may prevent the appearance of this element using simple properties of a column (IsFilterable="False")  and at a RadGridView level (through setting IsFilteringAllowed="False").  You do not have to predefine the template to achieve your goal. I strongly recommend you to use the properties mentioned above.     





Kind regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Adam
Top achievements
Rank 1
answered on 25 Jun 2012, 11:56 AM
Hello Vanya,

    I have applied both of those properties (GridView.IsFilteringAllowed & gridViewColumn.IsFIlterable) mentioned above to my Xaml code - no change.
0
Vanya Pavlova
Telerik team
answered on 25 Jun 2012, 12:07 PM
Hello Adam,

 

Can you post the grid version you are currently using? I have tested the behavior by my side using binaries from our latest official release (Q2 2012) and everything works correctly.
Will you please check the attached project and let me know how it differs from yours?  



Regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Adam
Top achievements
Rank 1
answered on 25 Jun 2012, 12:32 PM

Here is the RadGridView xaml code:

<telerik:RadGridView x:Name="dgDeliveries"
                                 AutoGenerateColumns="False"
                                 AlternateRowBackground="AliceBlue"
                                 AlternationCount="2"
                                 AllowDrop="True"
                                 CanUserSelect="True"
                                 CanUserDeleteRows="False"
                                 CanUserInsertRows="False"
                                 CanUserResizeColumns="True"
                                 EditTriggers="None"
                                 Grid.Row="1"
                                 IsFilteringAllowed="True"
                                 HorizontalGridLinesBrush="SlateGray"
                                 RowIndicatorVisibility="Collapsed"
                                 RowHeight="26"
                                 SelectionMode="Single"
                                 SelectionUnit="FullRow"
                                 ShowColumnFooters="False"
                                 ShowGroupPanel="False"
                                 ShowColumnHeaders="True"
                                 VerticalGridLinesBrush="Transparent">
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn Header="Requisition" EditTriggers="None" TextAlignment="Left" DataMemberBinding="{Binding Path=RequistionReference}" IsFilterable="True">
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Path=RequistionReference}"
                                           VerticalAlignment="Center"
                                           Padding="3,0,3,0"
                                           HorizontalAlignment="Right"
                                           TextAlignment="Right"/>
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                    </telerik:GridViewDataColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

Here is the GridViewHeaderCell.xaml file that was modified for the "custom" theme:
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"    
                    xmlns:grid="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView,Version=2012.1.0215.40,Culture=neutral,PublicKeyToken=5803cfa389c90ce7"
                    xmlns:treelist="clr-namespace:Telerik.Windows.Controls.TreeListView;assembly=Telerik.Windows.Controls.GridView,Version=2012.1.0215.40,Culture=neutral,PublicKeyToken=5803cfa389c90ce7"
                    xmlns:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView,Version=2012.1.0215.40,Culture=neutral,PublicKeyToken=5803cfa389c90ce7"
                    xmlns:external="clr-namespace:AssessedCostsShell.TelerikBAMTheme.Resources">
 
    <external:BAMNuttallTheme x:Key="Theme" />
     
    <SolidColorBrush x:Key="GridViewHeaderCellDropMarkerPenBrush" Color="White" />
    <SolidColorBrush x:Key="GridView_HeaderForeground_Selected" Color="#FF4C607A" />
    <SolidColorBrush x:Key="GridView_HeaderInnerBorder" Color="#FFFCFCFC" />
    <SolidColorBrush x:Key="GridView_HeaderOuterBorder_Over" Color="#FFC0CBD9" />
    <SolidColorBrush x:Key="GridView_HeaderOuterBorder" Color="#FFC0CBD9" />
    <SolidColorBrush x:Key="GridView_HeaderForeground" Color="#FF4C607A" />
    <SolidColorBrush x:Key="GridView_HeaderOuterBorder_Selected" Color="#FFC0CBD9" />
    <SolidColorBrush x:Key="GridView_SortIndicatorColor" Color="#FF4C607A" />
 
    <LinearGradientBrush x:Key="GridView_HighlightedColoumnHeader" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#88FFFFFF" Offset="0"/>
        <GradientStop Color="#880DB02B" Offset="1"/>
    </LinearGradientBrush>
     
    <grid:GridLineWidthToThicknessConverter x:Key="GridLineWidthToThicknessConverter" />
     
    <Pen x:Key="GridViewHeaderCellDropMarkerPen" Brush="{StaticResource GridViewHeaderCellDropMarkerPenBrush}" Thickness="2" />
     
    <Style x:Key="ColumnHeaderGripperStyle" TargetType="Thumb">
        <Setter Property="Width" Value="8"/>
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="Cursor" Value="SizeWE"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Thumb">
                    <Border Padding="{TemplateBinding Padding}"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
 
    <Style TargetType="ContentControl" x:Key="StretchedContentControl">
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
    </Style>
 
    <ControlTemplate x:Key="GridViewHeaderCellTemplate" TargetType="grid:GridViewHeaderCell">
        <Grid x:Name="PART_HeaderCellGrid">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto"  />
            </Grid.ColumnDefinitions>           
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="00:00:00.2000000" To="Normal" />
                        <VisualTransition GeneratedDuration="00:00:00.2000000" To="MouseOver" />
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="GridViewHeaderCell_Over" Storyboard.TargetProperty="Opacity">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource GridView_HeaderForeground_Selected}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Ascending">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource GridView_HeaderForeground_Selected}"/>
                            </ObjectAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_SortIndicator" Storyboard.TargetProperty="Opacity">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1" />
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="GridViewHeaderCell_Selected" Storyboard.TargetProperty="Opacity">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Descending">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource GridView_HeaderForeground_Selected}"/>
                            </ObjectAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_SortIndicator" Storyboard.TargetProperty="Opacity">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1" />
                            </DoubleAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_SortIndicator" Storyboard.TargetProperty="RenderTransform">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <ScaleTransform ScaleX="1" ScaleY="1" />
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="GridViewHeaderCell_Selected" Storyboard.TargetProperty="Opacity">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="GridViewHeaderCell" Grid.ColumnSpan="2"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}">
                <Border BorderBrush="{StaticResource GridView_HeaderInnerBorder}"
                        Background="{TemplateBinding Background}"
                        BorderThickness="1" />
            </Border>
            <Border x:Name="GridViewHeaderCell_Over" Grid.ColumnSpan="2"
                    Background="{StaticResource GridView_HighlightedColoumnHeader}"
                    BorderBrush="{StaticResource GridView_HeaderOuterBorder_Over}"
                    BorderThickness="{TemplateBinding BorderThickness}" Opacity="0" >
                <Border BorderBrush="Transparent"
                        Background="Transparent"
                        BorderThickness="0" />
            </Border>
            <Border x:Name="GridViewHeaderCell_Selected" Grid.ColumnSpan="2"
                    Background="{StaticResource GridView_HighlightedColoumnHeader}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}" Opacity="0" >
                <Border BorderBrush="Transparent"
                        Background="Transparent"
                        BorderThickness="0" />
            </Border>
            <ContentControl x:Name="ContentPresenter" Grid.Column="0" Foreground="{TemplateBinding Foreground}"
                            Style="{StaticResource StretchedContentControl}"
                            Margin="{TemplateBinding Padding}" IsTabStop="{TemplateBinding IsTabStop}"
                            Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
            <Path x:Name="PART_SortIndicator" Grid.ColumnSpan="2"
                  Fill="{StaticResource GridView_SortIndicatorColor}"
                  Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Top"
                  Margin="0,3,0,0"
                  Data="M0,0 L1,0 2,0 3,0 4,0 5,0 5,1 4,1 4,2 3,2 3,3 2,3 2,2 1,2 1,1 0,1 0,0 z"                          
                  Width="5" Height="3"
                  RenderTransformOrigin=".5,.5"
                  Opacity="0">
                <Path.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform ScaleX="1" ScaleY="-1"/>
                        <SkewTransform AngleX="0" AngleY="0"/>
                        <RotateTransform Angle="0"/>
                        <TranslateTransform X="0" Y="0"/>
                    </TransformGroup>
                </Path.RenderTransform>
            </Path>
            <grid:FilteringDropDown Name="PART_DistinctFilterControl" Grid.Column="1"
                                    Visibility="{TemplateBinding FilteringUIVisibility}"
                                    telerik:StyleManager.Theme="{StaticResource Theme}"
                                    Margin="0,0,8,0"/>
            <Thumb x:Name="PART_LeftHeaderGripper" HorizontalAlignment="Left" IsTabStop="{TemplateBinding IsTabStop}" Style="{StaticResource ColumnHeaderGripperStyle}" Grid.ColumnSpan="2" />
            <Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right" IsTabStop="{TemplateBinding IsTabStop}" Style="{StaticResource ColumnHeaderGripperStyle}" Grid.ColumnSpan="2" />
        </Grid>    
    </ControlTemplate>
 
    <Style x:Key="GridViewHeaderCellStyle" TargetType="grid:GridViewHeaderCell">
        <Setter Property="Template" Value="{StaticResource GridViewHeaderCellTemplate}" />       
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="#FF6D6D6D" />
        <Setter Property="BorderThickness" Value="0 1 1 2" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="7 0 0 0" />      
        <Setter Property="Foreground" Value="Black" />
        <Setter Property="FontWeight" Value="DemiBold"/>
        <Setter Property="DropMarkPen" Value="{StaticResource GridViewHeaderCellDropMarkerPen}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
    </Style>
 
    <Style TargetType="grid:GridViewHeaderCell" BasedOn="{StaticResource GridViewHeaderCellStyle}"/>
         
    <Style x:Key="{telerik:ThemeResourceKey ThemeType=
           external:BAMNuttallTheme , ElementType=grid:GridViewHeaderCell}"
           TargetType="grid:GridViewHeaderCell"  BasedOn="{StaticResource GridViewHeaderCellStyle}"/>
     
</ResourceDictionary>

There is not a huge difference between the original code and the 'modified' version above - but I still cannot determin where the issue with the missing indicator begins.
0
Vanya Pavlova
Telerik team
answered on 25 Jun 2012, 12:56 PM
Hello Adam,

 

I have tried to emulate the behavior you described, but I was not able to. Would you please take a look at the updated project and let me know what is the difference between yours and mine? If this does not help feel free to open a new support ticket and attach small repro application where we can see what is wrong. 



 

Greetings,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Adam
Top achievements
Rank 1
answered on 25 Jun 2012, 01:01 PM
I have taken a look at your example Vanya but it is also missing the filter control icon I am looking for.
I wonder if I have been mistaken...
I thought that the RadGridView automatically implemented the column data filtering via a small button (located right side of the header cell) and a dropdown?

EDIT:Okay, I was being silly. I have adjusted the xaml code so that IsFilteringAllowed is now true and the filter control has appeared...
But I still do not know why my current project is not showing the same icon!?
0
Vanya Pavlova
Telerik team
answered on 25 Jun 2012, 01:16 PM
Hello Adam,

 

The icon is missing because the IsFilterable property of the column is set to False.
If you remove this property setting from a column in the previous project the filter icon will appear. 
If you press the button after removing this setting you may see the FilteringControl. 
Considering the description of your problem I suggested that you have problems with a style.... 


A while back I threw together a basic GridView theme for use by my company... The problem is that I originally removed the ability to use the built in filter control and now I cannot remember what I removed from the structure.
I have located the 'PART_DistinctFilterControl' control's code, which seems fine, but I cannot find anything else that would prevent the filter indicator from showing... Unless I have completely removed the button's code! 



My first though is that you have removed the FilteringDropDown from a template. By that reason I suggested to use the IsFilterable, IsFilteringAllowed properties instead of removing it from a style. 
The Visibility of this element is controlled by the FilteringUIVisibility property and this one determines whether the icon is visible or not.  Furthermore your collection should implement the required interfaces which enable sorting, filtering etc.   If you are bound to a plain ObservableCollection will you verify whether the behavior is the same?  



Regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Adam
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Adam
Top achievements
Rank 1
Share this question
or