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

[Solved] Styling Filtering Controls

1 Answer 110 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sherwin
Top achievements
Rank 1
Sherwin asked on 22 Aug 2011, 03:33 PM
 Is there any way I can edit the style of the default filtering controls?

I'm using Silverlight 4 and telerik V.2011.1.419.1040.

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 23 Aug 2011, 04:20 PM
Hello Sherwin,

 Yes, you may edit the style of the Filtering control. In order to do this you should edit the template of the FilteringControl.

<Style x:Key="ss" TargetType="{x:Type telerik:FilteringControl}" >
...
<ListBox x:Name="PART_DistinctValuesList" ItemsSource="{Binding DistinctValues}" ScrollViewer.HorizontalScrollBarVisibility="Auto" MaxHeight="100" SelectionMode="Multiple">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Content="{Binding ConvertedValue}" IsChecked="{Binding IsActive, Mode=TwoWay}" VerticalContentAlignment="Center">                <telerik:StyleManager.Theme>                                  <telerik:Office_BlackTheme/>                             </telerik:StyleManager.Theme>          </CheckBox>
</DataTemplate>
</ListBox.ItemTemplate>
<telerik:StyleManager.Theme>
<telerik:Office_BlackTheme/>
</telerik:StyleManager.Theme>
</ListBox>
...

Then you may apply this style to a specific column like so:

<telerik:GridViewDataColumn FilteringControlStyle="{StaticResource changedFilteringStyle}" DataMemberBinding="{Binding LastName}"/>

However there is something special. There is a control 'StringFilterEditor', which is responsible for displaying editors based on the type of the underlying property. You may access this control through subscribing the RadGridView's FieldFilterEditorCreated event and set the theme for the editor from there.:
Copy Code
private void grid_FieldFilterEditorCreated(object sender, Telerik.Windows.Controls.GridView.EditorCreatedEventArgs e)
       {
           if (e.Editor is RadDateTimePicker)
           {
               StyleManager.SetTheme((e.Editor as RadDateTimePicker), new Office_BlackTheme());
           }
       }


I hope that this is helpful. Please let me know in case you have any further questions.

Regards,
Didie
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
GridView
Asked by
Sherwin
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or