Simplify Requirements

2 posts, 1 answers
  1. Joel Palmer
    Joel Palmer avatar
    164 posts
    Member since:
    May 2009

    Posted 14 Aug 2015 Link to this post

    If this isn't possible, telling me "no" would be fully acceptable but I must ask:

    • Is there a way to​ separate the column order from the drop down order?
    • Is there a way to eliminate the Match Case button and never have it try to match the case?
    • Is there a way to only allow a top level filter?  So, don't have the + button on a lower level.
    • Can I default to "Contains" instead of "Is equal to"?

    Thanks for your help,


  2. Answer
    Stefan X1
    Stefan X1 avatar
    485 posts

    Posted 18 Aug 2015 Link to this post

    Hello Joel,

    I will try to suggest an approach for each requirement in the same order as from your enquiry.

    1.   I am not completely sure what you mean by "column order" and "drop down order". If your goal is to change the positions of the Members drop down and Operators drop down, you can modify the template of RadDataFilter. Can you please confirm that? You can take a look at the Visual Structure topic for further reference.

    If this is the customization you are trying to achieve, please search for the two RadComboBox controls with x:Name="PART_SimpleFilterMemberComboBox" and x:Name="PART_SimpleFilterOperatorComboBox" in the template of RadDataFilter and simply swap their order. The template of the control is in Telerik.Windows.Controls.Data.xaml file.

    2.   A possible approach for restricting the usage of the button for adding a nested operator, would be to subscribe to the PreviewMouseLeftButtonDown event of RadButton control and cancel the event if needed. This particular RadButton is with x:Name="PART_ToCompositeFilterButton". You can take a look at the code snippet below:
    dataFilter.AddHandler(RadButton.PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(HandleMouse));
    private void HandleMouse(object sender, MouseButtonEventArgs e)
                var source = e.OriginalSource as UIElement;
                if (source == null)
                var button = source.ParentOfType<RadButton>();
                if (button != null && button.Name == "PART_ToCompositeFilterButton")
                    e.Handled = true;

    Please note, that you will need to implement custom logic as per your requirements to handle this case.

    3.   I believe that this question is related to the previous one. Custom logic for restricting the user to add nested operators should be implemented using the event from the previous point. Note, that determining the level of a given Filtering Criteria might be quite laborious. A possible resolution might be to traverse the visual tree and keep references of a given object at each level. Then through reference comparison you can determine at which level a particular element is.

    4.   If you take a look at the aforementioned RadComboBox with x:Name="PART_SimpleFilterOperatorComboBox" you will notice that its ItemTemplate is a DataTemplate with x:Key="FilterOperatorTemplate". Within it there is a TextBlock element defined and for its Text property a Converter with x:Key="FilterOperatorConverter" is applied. So, what you can do is define your custom IValueConverter and handle this logic in it.
    public object Convert(object value, Type targetType,
        object parameter, System.Globalization.CultureInfo culture)
        if (value.ToString() == "IsEqualTo")
            return "Contains";
        return value;

    I hope this suggestions will help you achieve the desired customizations.

    Best Regards,
    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 Feedback Portal and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top