Need help with Exception: Value does not fall within the expected range

5 posts, 0 answers
  1. Kathleen
    Kathleen avatar
    55 posts
    Member since:
    Jun 2009

    Posted 01 Sep 2010 Link to this post

    {System.ArgumentException: Value does not fall within the expected range.
       at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
       at MS.Internal.XcpImports.MethodEx(DependencyObject obj, String name)
       at System.Windows.UIElement.UpdateLayout()
       at Telerik.Windows.Controls.PopupWrapper.AdjustPopupLocation()
       at Telerik.Windows.Controls.RadComboBox.AdjustPopupLocation()
       at Telerik.Windows.Controls.RadComboBox.UpdateItemsVisibility(Boolean showAll, List`1 matchIndices)
       at Telerik.Windows.Controls.RadComboBox.DropDownPopupOpened(Object sender, EventArgs e)
       at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)}

    Its going to be a bit difficult to replicate this, so I'm hoping that based on the stack trace, I can get a hint as to what might be going on.

    We have a series of combo boxes on a form.  Selecting a value in 1 will filter the contents of another (or multiple). 

    Within one combo, if we select a value via drop down and click (combo closes), then try to  to select another value, this exception occurs.  This exception only occurs under the following scenario:

    The combo box itemssource has changed between selections, and the combo box doesn't lose focus.

    We are using the 8/21 internal build.

    Consider it like this:
    Food Categories - Changing a category, filters food choices.
    Food Choices

    Selecting a Food, changes the selected Food Category which in turns further filters Food.  If you try to drop down the Food combo box a second time after its itemsource has been updated, this error occurs.

  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 03 Sep 2010 Link to this post

    Hi Kathleen,

    We fixed very similar problem that occurs when you change the ItemsSource of RadComboBox in the property setter of a property that is bound to SelectedItem (or SelectedValue, or SelectedIndex). The fix will be published today, please check if the exception is thrown with the new version. If the problem persists, I would need a simple application that resembles your scenario, even if the problem is hardly reproducible.

    Regards,
    Valeri Hristov
    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. DevCraft banner
  4. Kathleen
    Kathleen avatar
    55 posts
    Member since:
    Jun 2009

    Posted 27 Jan 2011 Link to this post

    This is becoming a bigger problem now, especially since we are close to 'release' readiness.

    I downloaded the January 14th release, and its still a problem.  However, I'm having a hard time replicating it outside our solution to post here.

    Is there any other way to debug this problem?

    In summary, we have a data form that has combo boxes replaced during the AutoGenerate method, the combo box is bound to a property on the view model and looks something like this:

     

     

    this.SetItemsSourceBinding(comboBox, e.PropertyName, e.PropertyType, lookupAttribute, propertyInfo);

     

    e.Field.Content = comboBox;

    e.Field.Content.SetBinding(

     

    RadComboBox.IsEnabledProperty, new Binding("IsEnabled") { Source = e.Field });

     

     

     

    private void SetItemsSourceBinding(FrameworkElement element, string propertyName, Type propertyType, LookupFieldAttribute lookupFieldAttribute, PropertyInfo propertyInfo)

     

    {

    itemsSourceBinding =

     

     

    new Binding(string.Format("FilterManager.{0}.Items", fmPropertyInfo.Name))

     

    {
    Source =

     

    this.EntityViewModel,

     

    Mode =

     

    BindingMode.OneWay

     

    };

     

     

     

    // set the itemssource binding

     

     

     

     

     

    element.SetBinding(

     

    ItemsControl.ItemsSourceProperty, itemsSourceBinding);

     

     

     

    // set the display member path to the lookup item's description.

     

     

     

     

     

    ((

     

    ItemsControl)element).DisplayMemberPath = "Description";

     

     

     

    // set the selected item binding to a converter that knows how to convert between the property's value

     

     

     

     

     

     

     

    // and a lookup item.

     

     

     

     

     

    element.SetBinding(

     

    Selector.SelectedItemProperty,

     

     

     

    new Binding(propertyName)

     

    {

    Mode =

     

    BindingMode.TwoWay,

     

    Converter =

     

    new LookupBoundItemsControlToLookupItemConverter(),

     

    ConverterParameter = element

    });

  5. Kathleen
    Kathleen avatar
    55 posts
    Member since:
    Jun 2009

    Posted 27 Jan 2011 Link to this post

    If I remove this from my template the problem goes away, but then we get re-introduce a performance issue with large lists:

    <Setter Property="ItemsPanel">

    <Setter.Value>

    <ItemsPanelTemplate>

    <VirtualizingStackPanel />

    </ItemsPanelTemplate>

    </Setter.Value>

    </Setter>

  6. George
    Admin
    George avatar
    1332 posts

    Posted 02 Feb 2011 Link to this post

    Hi Kathleen,

     

    We will greatly appreciate a sample project of yours. It will definitely help us in further pinpointing and resolving the problem. Can you attach the sample project to this thread? 



    Regards,
    George
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top
DevCraft banner