Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1564
Bug in xamShowCase ?
posted

 Hi,

In the xamShowCase, in the music player, you use the following method "GetCenterPositionOffset" to put a album cover in the front : 

But in this method you use "viewSettings.ItemsPerPage" to know the number of items !

In a real application, we have [0,viewSettings.ItemsPerPage] items displayed ! If we only have 3 items when ItemsPerPage= 10, the calculation is wrong.

We need a way to know the "current number of visible items" ! So, how can we have this information ?

 

Thanks 

  • 8576
    Verified Answer
    Offline posted
    Hi -
     
    Something like this would get you the total visible items in a xamDataCarousel:
     

    private int GetTotalVisibleItems(XamDataCarousel xamDataCarousel)

    {

    int firstVisibleItemIndex = (int)xamDataCarousel.ScrollInfo.VerticalOffset;

    if (xamDataCarousel.ViewableRecords.Count <= xamDataCarousel.ViewSettings.ItemsPerPage)

    return xamDataCarousel.ViewableRecords.Count - Math.Abs(firstVisibleItemIndex);

    else if (firstVisibleItemIndex < 0)

    return xamDataCarousel.ViewSettings.ItemsPerPage - Math.Abs(firstVisibleItemIndex);

    else

    return Math.Min(xamDataCarousel.ViewSettings.ItemsPerPage, xamDataCarousel.ViewableRecords.Count - firstVisibleItemIndex);

    }

    }

     
    Joe