telerik : raddatafilter and Rad combbobx

1 posts, 0 answers
  1. Ali
    Ali avatar
    1 posts
    Member since:
    May 2016

    Posted 13 May Link to this post

    I add raddatafilter as following :

    <Grid><Grid.Resources><DataTemplate x:Key="CountryComboboxTemplate" ><telerik:RadComboBox x:Name="CountryCombox2" TabIndex="3"HorizontalAlignment="Left" VerticalAlignment="Center"DisplayMemberPath="CountryName" IsTabStop="True"ClearSelectionButtonContent="Clear" ClearSelectionButtonVisibility="Visible"CanAutocompleteSelectItems="True" CanKeyboardNavigationSelectItems="True"IsEditable="True" IsReadOnly="False" IsTextSearchEnabled="True"OpenDropDownOnFocus="True" IsFilteringEnabled="True"TextSearchMode="Contains" IsDropDownOpen="False" SelectedValue="{Binding Value, Mode=TwoWay, FallbackValue=null}"Width="200" Background="{x:Null}" BorderBrush="{x:Null}" Height="30" Foreground="{DynamicResource white-forground}" Margin="0,5" Grid.Row="2" Grid.Column="2"/></DataTemplate><behaviors:EditorTemplateSelector x:Key="MyEditorTemplateSelector"><behaviors:EditorTemplateSelector.EditorTemplateRules><behaviors:EditorTemplateRule PropertyName="Country" DataTemplate="{StaticResource CountryComboboxTemplate}" /></behaviors:EditorTemplateSelector.EditorTemplateRules></behaviors:EditorTemplateSelector></Grid.Resources><telerik:RadDataFilter Name="Filter" telerik:StyleManager.Theme="Windows8"EditorCreated="OnRadDataFilterEditorCreated"Loaded="Filter_Loaded"MinHeight="193"MaxHeight="250"Width="Auto"Grid.Row="0" behaviors:FilterDescriptorBindingBehavior.FilterDescriptors="{Binding FilterDescriptors, Source={StaticResource model}}"EditorTemplateSelector="{StaticResource MyEditorTemplateSelector}"Margin="1" /></Grid>

    the problem is the country not fill in the filter always country is equal too empty , not the selected country
    and code behind looks like

    public FilterDataUserControl(){InitializeComponent();var list = new List<FilterCriterea>();list.Add(new FilterCriterea());Filter.Source = list;}private void OnRadDataFilterEditorCreated(object sender, EditorCreatedEventArgs e){if (DataContext != null){var datacontextVm = DataContext as AdvancedSearchManagerViewModel;if (datacontextVm != null){switch (e.ItemPropertyDefinition.PropertyName){case "Country":RadComboBox countrycomboBoxEditor = (RadComboBox)e.Editor; countrycomboBoxEditor.ItemsSource = datacontextVm.CountryCollectionViewModelIns;break;}}}}private void Filter_Loaded(object sender, RoutedEventArgs e){Filter.ItemPropertyDefinitions.Add(new ItemPropertyDefinition("Country", typeof(Country), "Country"));}}

     

Back to Top