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

How to set filter operator

4 Answers 136 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Lilia
Top achievements
Rank 1
Lilia asked on 15 Aug 2011, 12:17 PM
Can you tell me how can I set a default filter operator (for example "Is equal to") when I add a new filter criteria and I change the members drop down?

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 15 Aug 2011, 02:52 PM
Hello Lilia,

Please take a look at this forum thread. Does the solution suggested there corresponds to your requirements ?
 

Best wishes,
Maya
the Telerik team

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

0
Lilia
Top achievements
Rank 1
answered on 15 Aug 2011, 04:39 PM
Can you give me an example with RadDataFilter. I have this in xaml:

<telerik:RadDataFilter x:Name="dataFilterSearchCriteria"
                        EditorTemplateSelector="{StaticResource EditorTemplateSelector}"
                        AutoGenerateItemPropertyDefinitions="False"                                      
                        CanUserCreateCompositeFilters="False"
                        Margin="0,0,0,0"
                        Canvas.ZIndex="1">
    <telerik:RadDataFilter.ItemPropertyDefinitions>
        <my:ItemPropertyDefinition DisplayName="Franchise name selector"
                                    PropertyName="Name"
                                    PropertyType="{Binding Source={StaticResource types}, Path=String}" />
        <my:ItemPropertyDefinition DisplayName="Date From"
                                    PropertyName="DateFrom"
                                    PropertyType="{Binding Source={StaticResource types}, Path=DateTime}" />
        <my:ItemPropertyDefinition DisplayName="Date To"
                                    PropertyName="DateTo"
                                    PropertyType="{Binding Source={StaticResource types}, Path=DateTime}" />
    </telerik:RadDataFilter.ItemPropertyDefinitions>
</telerik:RadDataFilter>

And I've tried to do this in "FilterOperatorsLoading" event, but it didn't do nothing:

var comboBox = ((RadDataFilter)e.TriggerSource).ChildrenOfType<RadComboBox>()
                .Where(b => b.Name == "PART_SimpleFilterOperatorComboBox")
                .FirstOrDefault();
if (comboBox != null)
{
     comboBox.SelectedIndex = 0;
}


0
Lilia
Top achievements
Rank 1
answered on 16 Aug 2011, 10:08 AM
I found my mistake. The problem was that I wasn't selecting the right ComboBox. Here is the right code:

var comboBox = ((RadDataFilter)e.TriggerSource).ChildrenOfType<RadComboBox>()
                           .Where(b => b.Name == "PART_SimpleFilterOperatorComboBox")
                           .LastOrDefault();
if (comboBox != null)
{
   comboBox.SelectedIndex = 0;
}

I replaces FirstOrDefault with LastOrDefault to select the last added ComboBox.
0
Rossen Hristov
Telerik team
answered on 31 Aug 2011, 12:37 PM
Hi Lilia,

Can you please answer the question that my colleague asked in your other thread first.

Thank you.

Kind regards,
Ross
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
DataFilter
Asked by
Lilia
Top achievements
Rank 1
Answers by
Maya
Telerik team
Lilia
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or