Open Filter Dialog in RadGridViwe via Shortcut

6 posts, 1 answers
  1. Julian
    Julian avatar
    77 posts
    Member since:
    Dec 2010

    Posted 26 May 2011 Link to this post

    Hi guys,

    Well, my questions is short as subject: is there possibility to open filter dialog by pressing for instance ALT+C, instead of clicking the filter icon via mouse.

    thanks,
    Julian
  2. Answer
    Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 27 May 2011 Link to this post

    Hi Julian,

     Yes, you could open the filter dialog by pressing a key combination, or a button. 

    If your GridView is named clubsGrid, you may show the filtering window from the code like this:

    var firstFilteringDropDown = this.clubsGrid.ChildrenOfType<FilteringDropDown>();
                int columnIndex = this.clubsGrid.CurrentCellInfo.Column.DisplayIndex;
                if (firstFilteringDropDown != null)
                {
                    firstFilteringDropDown[columnIndex].IsDropDownOpen = true;
                }

    What you need to additionally do is to create a command, that calls this code when the combination of Alt+C occurs. 
    <Window.InputBindings>
      <KeyBinding Command="ShowFilter" Key="C" Modifiers="Alt"/>
    </Window.InputBindings>

    With this XAML, we have added what imput gestures will trigger the command. Now, if the window has focus, and you hit Alt+C , the command "ShowFilter" will get executed. 

    Best wishes,
    Didie
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Julian
    Julian avatar
    77 posts
    Member since:
    Dec 2010

    Posted 27 May 2011 Link to this post

    Thank you guys for this solution :)

    regards,
    Julian
  4. Kasper
    Kasper avatar
    2 posts
    Member since:
    Feb 2014

    Posted 18 Mar 2015 Link to this post

    Hello there

    I know this is an old post but since i used the code in the answer i will write my question/request here.

    After the latest update of Telerik I get a NullReferenceException when i call IsDropDownOpened from codebehind. 

    Source: Telerik.Windows.Controls.GridView
    StackTrace: at Telerik.Windows.Controls.GridView.FilteringDropDown.OnIsDropDownOpenChanged(Boolean oldValue, Boolean newValue)

    TargetSite: {Void OnIsDropDownOpenChanged(Boolean, Boolean)}

    Is it possible that this can be fixed in the next version of Telerik for WPF?

    Best regards,
    Kasper



  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 18 Mar 2015 Link to this post

    Hi Kasper,

    I could apply a blind fix thanks to the StackTrace you sent, but I guess it would be much better if I can test it on my side. Could you take a look at the project attached and let me know how I can reproduce the exception on it ? 

    Regards,
    Maya
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Kasper
    Kasper avatar
    2 posts
    Member since:
    Feb 2014

    Posted 19 Mar 2015 in reply to Maya Link to this post

    Hello Maya

    Thank you for the fast reply.

    I tried to reproduce the exception in your solution, and it made me realize that the exception was thrown because i tried to set the IsDropDownOpen on a column that did not have a filter (I got the filter of the wrong column because of some confusion with invisible columns). 

    Sorry for bothering you with an exception that was not due to an error in the Telerik framework. And thank you for helping me find the actual error :) 

    Best Regards,
    Kasper

Back to Top