Databound items do not show until user scrolls

42 posts, 0 answers
  1. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 30 Jan 2012 Link to this post

    Hi Jog,

    The fix will be available in our next official release Q1 2012 that is to be release in the middle of February.  

    All the best,
    Maya
    the Telerik team

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

  2. Jog Rad
    Jog Rad avatar
    15 posts
    Member since:
    Nov 2011

    Posted 30 Jan 2012 Link to this post

    Hi Maya,

    Thanks

    Best Regards,
    Jog
  3. UI for WPF is Visual Studio 2017 Ready
  4. Nolan Barnes
    Nolan Barnes avatar
    2 posts
    Member since:
    Mar 2010

    Posted 29 Mar 2012 Link to this post

    Hi Maya,

    thanks for the advice to look into his thread.
    The problem still exists. I am currently working with Q1 2012 and I have still the same problem.
    The workaround is not an option, when the radcarousel is part of a lookless customcontrol. 
    I thought of another workaround:
    The radcarousel must know its itemsperpage dynamically binded to an  itemsource count. Unfortunately I ran into another problem with this idea: it will also change the style and measures of the carouselpanels.
    To be honest, I am not a great fan of workaraounds!
    So what is the real solution??
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 29 Mar 2012 Link to this post

    Hello Nolan,

    I tested the project attached in this thread with our current official release (Q1 2012 SP1) and everything works as expected.  You can try it on and check that the required item is scrolled into view once Loaded event of RadCarousel is fired. Furthermore, if you remove the whole handler, all items will be displayed as well (this, however, depends on the number of items per page and the number of the items in the source).
    Could you clarify what is the behavior that you get ? 


    Greetings,
    Maya
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. kilhoffer
    kilhoffer avatar
    40 posts
    Member since:
    May 2007

    Posted 20 May 2013 Link to this post

    I'm using the Q1 2013 release and still see the same behavior after a few years of waiting for this to be fixed. The PITS report says it was fixed, but I'm not seeing it. Was this something that was part of a hotfix and didn't make it into a release build?
  7. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 20 May 2013 Link to this post

    Hi Anthony,

    The issue I resolved before was that some methods were invoked before RadCarouselPanel is loaded (the one mentioned above in this thread).  Do you refer to this bug as it fixed wih the internal builds then and it is available in our official releases ?

    All the best,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  8. kilhoffer
    kilhoffer avatar
    40 posts
    Member since:
    May 2007

    Posted 20 May 2013 Link to this post

    I'm referring to the first post in this thread, which I posted in 2011. I see the exact same behavior in the control, where if I bind to an observable collection of items, when the carousel is displayed, all items are scrolled out of view.
  9. N Mackay
    N Mackay avatar
    228 posts
    Member since:
    Dec 2010

    Posted 20 May 2013 Link to this post

    I couldn't get this working either when I started porting our proof of concept over to a New Prism MVVM shell.

    I use this code when you add or remove something from the ObervableCollection


    <telerik:RadCarousel x:Name="_carousel_quickview"
                                               ItemsSource="{Binding OpenModules}"
                                               ItemTemplate="{StaticResource CarouselItemTemplate}"
                                               BorderThickness="1"
                                               Padding="1"
                                               Margin="0,0,1,0"
                                               BorderBrush="LightGray"
                                               MaxHeight="116" Height="Auto"
                                               VerticalAlignment="Stretch"
                                               HorizontalScrollBarVisibility="Hidden"
                                               VerticalScrollBarVisibility="Hidden"
                                               PreviewMouseWheel="_carousel_quickview_PreviewMouseWheel"
                                               PreviewKeyDown="_carousel_quickview_PreviewKeyDown" >
     
                   <telerik:RadCarousel.ItemsPanel>
                       <ItemsPanelTemplate>
                           <telerik:RadCarouselPanel ItemsMovementAnimationDuration="0:0:0"
                                                             ItemsPerPage="7"
                                                             PathPadding="-140"
                                                             IsOpacityEnabled="False"
                                                             AutoLoadItems="True"
                                                             Path="{StaticResource carousel_horizontalPath}" >
     
                               <!--This allows all carousel items to be the same size-->
                               <telerik:RadCarouselPanel.ScaleStops>
                                   <telerik:PathStopCollection>
                                       <telerik:PathStop PathFraction="5.4" Value="1.0"/>
                                   </telerik:PathStopCollection>
                               </telerik:RadCarouselPanel.ScaleStops>
     
                           </telerik:RadCarouselPanel>
                       </ItemsPanelTemplate>
                   </telerik:RadCarousel.ItemsPanel>
     
                   <i:Interaction.Triggers>
                       <i:EventTrigger EventName="SelectionChanging">
                           <commands:EventToCommand Command="{Binding ActivateModule}" PassEventArgsToCommand="True"  />
                       </i:EventTrigger>
                   </i:Interaction.Triggers>
               </telerik:RadCarousel>


    private void CarouselCentre()
            {
                if (_carousel != null)
                {
                    RadCarouselPanel Panel = _carousel.FindCarouselPanel();
                    if (Panel != null) { Panel.BringDataItemIntoView(_openModules[_openModules.Count / 2]); }
                }
            }
     
    Adding an item
     
    try
                {
                    // Remove the control if it exists
                    var moduleSearch = from ModPreview in _openModules where ModPreview.ModuleName == module.ModuleName select ModPreview;
     
                    if (moduleSearch.Count() > 0)
                    {
                        _openModules[_openModules.IndexOf(moduleSearch.FirstOrDefault())] = module;
                        RaisePropertyChanged("OpenModules");
                    }
                    else
                    {
                        _openModules.Add(module);
                        CarouselCentre();
                    }
                     
                }

    Despite specifying AutoLoadItems it never does anything, you had to use the mousewheel over the carousel to bring A single item into view, it must have worked at some stage as I tested a build but that was back in 2011, this works and I was bugging Maya (who's been very helpful) about other UX stuff so didn't bother reporting it.

    Also requires me to keep a reference to the carousel in the viewmodel as I couldn't seem to find a way of detecting the control was initialized using an MVVM approach.  This viewmodel is based on MVVM Light btw.
  10. kilhoffer
    kilhoffer avatar
    40 posts
    Member since:
    May 2007

    Posted 20 May 2013 Link to this post

    @N MacKay: I just used your workaround and it works as I would expect the carousel to work. Thanks for the solution. I wish we didnt have to put workarounds like this in our code to get it to behave as most would expect.
  11. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 23 May 2013 Link to this post

    Hello all,

    The thing is that this behavior has never been considered as a bug, but like default behavior - a consequence of the ItemsPerPage/ Items to be loaded values. And so far, the approach by calling one of the methods mentioned above was acceptable. However, you do have quite a valid point - this behavior may not be quite convenient and expected in some cases. I will investigate the case and see whether this can be changed without introducing breaking changes or any undesirable effects. 

    Regards,
    Maya
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  12. N Mackay
    N Mackay avatar
    228 posts
    Member since:
    Dec 2010

    Posted 28 May 2013 Link to this post

    If anyone uses that CarouselCenter code there was a possibility of a divide by zero which this fixes.

    private void CarouselCenter()
            {
                if (_carousel != null & _openModules.Count() > 0)
                {
                    RadCarouselPanel Panel = _carousel.FindCarouselPanel();
                    if (Panel != null) { Panel.BringDataItemIntoView(_openModules[_openModules.Count / 2]); }
                }
            }
  13. Melissa
    Melissa avatar
    5 posts
    Member since:
    Jan 2014

    Posted 20 Jul in reply to N Mackay Link to this post

    Thank you. This is still an issue in 2016 Q2 and this solution still works.
Back to Top
UI for WPF is Visual Studio 2017 Ready