RadAutoCompleteBox with dynamic ItemSource problem.

3 posts, 1 answers
  1. Bryan
    Bryan avatar
    2 posts
    Member since:
    Feb 2014

    Posted 18 Feb 2019 Link to this post

    I have an RadAutoCompleteBox with a dynamic ItemSource that works some places and not others.  In the setter for the SearchText I run a search and populate the ItemSource.  In the box I'm working on now, the ItemSource's ObservableCollection is giving me "Exception thrown: 'System.ArgumentException' in System.Core.dll" when i try and add item to it. This method works many places elsewhere, and If i manually set the SearchText elsewhere the offending code runs without error. Any help would be greatly appreciated.

    Here's the XAML:


        Grid.Column="2" Grid.Row="3"
        ItemsSource="{Binding MakeModelCollection}"
        SearchText="{Binding MakeModelTerm, Mode=TwoWay}"
        SelectedItem="{Binding SelectedMakeModel, Mode=TwoWay}"
        IsDropDownOpen="{Binding IsMakeModelDropDownOpen, Mode=TwoWay}"
        DropDownItemTemplate="{StaticResource MakeModelSearchTemplate}"
        VerticalAlignment="Top" Width="275"  Height="25" Margin="0,3,0,0" >


    And here's the offending code:

    private string makeModelTerm;
    public string MakeModelTerm
        get { return makeModelTerm; }
            if (makeModelTerm == value)
            makeModelTerm = value;
            if (value.Length > 2)

    private void SearchMakeModel(string value)
        LookUpRepository er = new LookUpRepository();
        var list = er.SearchMakeModel(value);
        list.ForEach(MakeModelCollection.Add); // This triggers the System.ArgumentException on each value in list
        this.IsMakeModelDropDownOpen = true;

  2. Answer
    Vladimir Stoyanov
    Vladimir Stoyanov avatar
    657 posts

    Posted 21 Feb 2019 Link to this post

    Hello Bryan,

    Thank you for the provided sample code. 

    I tried to reproduce the described exception on my end, however I was not able to do so. I created a sample application based on the provided code and replaced/guessed the parts of the code that were not available and I am attaching it for your reference.

    May I ask you to check out the sample project and see how it differs from the setup on your end? Should you need any further assistance, may I kindly ask you to modify the sample project in order to reproduce the observed on your end behavior and send it back? This way I will be able to investigate the scenario on my end and better assist you. 

    I am looking forward to your reply.

    Vladimir Stoyanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Bryan
    Bryan avatar
    2 posts
    Member since:
    Feb 2014

    Posted 21 Feb 2019 in reply to Vladimir Stoyanov Link to this post



    I realized that my TextSearchPath had a typo in it which was causing the exception.

Back to Top