Bug when setting items per page?

6 posts, 0 answers
  1. Scott
    Scott avatar
    43 posts
    Member since:
    Nov 2007

    Posted 29 Sep 2008 Link to this post

    I am using the RadCarouselPanel inside a ListBox and have always set ItemsPerPage to be around 20.  When I decided to lower this to 5 or 10, I get "index was outside the bounds of the array" when clicking on the item in my ListBox.  If I set back to 20, it works again.

    This is the stacktrace for the exception:


             StackTrace    "   at Telerik.Windows.Controls.Carousel.Animations.DecreaseItemsPerPageAnimation.AddItemToStay(ChildIndexPair item)\r\n   at Telerik.Windows.Controls.Carousel.Animations.DecreaseItemsPerPageAnimation.AddItemToAnimate(ChildIndexPair item)\r\n   at Telerik.Windows.Controls.RadCarouselPanel.PrepareAnimation(PathAnimation animation)\r\n   at Telerik.Windows.Controls.RadCarouselPanel.RunScheduledAnimation()\r\n   at Telerik.Windows.Controls.RadCarouselPanel.MeasureOverride(Size availableSize)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)\r\n   at System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)\r\n   at System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)\r\n   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)\r\n   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Border.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Control.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)\r\n   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)\r\n   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)\r\n   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Border.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Control.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)\r\n   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)\r\n   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)\r\n   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Border.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Control.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)\r\n   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)\r\n   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)\r\n   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Border.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Page.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)\r\n   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Border.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Control.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)\r\n   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Border.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)\r\n   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)\r\n   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Control.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)\r\n   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)\r\n   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)\r\n   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)\r\n   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)\r\n   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Decorator.MeasureOverride(Size constraint)\r\n   at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Controls.Border.MeasureOverride(Size constraint)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.Window.MeasureOverrideHelper(Size constraint)\r\n   at System.Windows.Window.MeasureOverride(Size availableSize)\r\n   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)\r\n   at System.Windows.UIElement.Measure(Size availableSize)\r\n   at System.Windows.ContextLayoutManager.UpdateLayout()\r\n   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)\r\n   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()\r\n   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()\r\n   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)\r\n   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)\r\n   at System.Windows.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget)\r\n   at System.Windows.Interop.HwndTarget.OnResize()\r\n   at System.Windows.Interop.HwndTarget.HandleMessage(Int32 msg, IntPtr wparam, IntPtr lparam)\r\n   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)\r\n   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)\r\n   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)\r\n   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)\r\n   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)"    string
  2. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 01 Oct 2008 Link to this post

    Hi Scott,

    I was unable to reproduce the exception that you reported. May I ask you to open a support ticket and send us a sample project where this problem is evident? This would really help us solve the problem in a more timely fashion.

    We have updated your Telerik points as per our EAP Program.

    Greetings,
    Milan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Scott
    Scott avatar
    43 posts
    Member since:
    Nov 2007

    Posted 01 Oct 2008 Link to this post

    What was happening is that I had initialized my panel with ItemsPerPage=19.  Then based on some other criteria, I changed ItemsPerPage to 5.  This is what caused the problem index out of range problem in the carousel.  After removing the initialization code, it works fine now.  I thought that by initially setting it to 19, and then overriding when needed, it wouldn't cause a problem, but in this case it did.

  5. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 02 Oct 2008 Link to this post

    Hello Scott,

    It is great to hear that you have found a workaround. Yet, could you please be more specific about the place (constructor, event handler, etc) where you first initialized the ItemsPerPage property to 19, and then changed it to 5?
    That kind of information will be very helpful since we will be able to trace your steps and fix the problem.

    Thanks in advance.

    Regards,
    Milan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Scott
    Scott avatar
    43 posts
    Member since:
    Nov 2007

    Posted 03 Oct 2008 Link to this post

    I have a page where I can select from 3 views - one view is a listbox, one is a RadGridView, and one is a ListBox wrapped around a RadCarouselPanel.  When I click to change the view, I get the ItemSource and bind it to the appropriate control (ListBox, RadGridView, or ListBoxCarousel).   If it's my Carousel view, I call a method that finds my path and sets the properties I want.

    Within that method, I have a switch statement that lets me choose from different states.  I can collapse all the views to the left of the screen when I choose an item in them.  So I check the state of it and set the ItemsPerPage to a lower number when collapsed, and a higher number when full screen.  What I was doing before was defaulting it at the top of my method to be 19.  Then, if collapsed, I overlaid that property with 5.  It worked fine as long as I was always in my view screen, 19 items view.  When I collapsed and it went to 5 items, it correctly showed 5 items in the Carousel, but if I select any of them, it blew up on index out of range.

    So my solution was to not default it at 19, but set it to 19 when I was full screen, and set it to 5 when I was collapsed.  If I switch it back to the previous way where I initialize it to 19, it failed again.   I'm not rebinding between these views, just changing their items per page.  But somehow, when overlaying that property, it messed up the listbox underneath.

    That's the best explanation I can come up with.  It works fine now.
  7. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 07 Oct 2008 Link to this post

    Hi Scott,

    Thanks for the detailed explanation. We will now try to reproduce the exception and fix the problem.

    Best wishes,
    Milan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
UI for WPF is Visual Studio 2017 Ready