I have a carousel list box that contains multiple rectangles. These rectangles are inside a canvas. The canvas has two text blocks. If the item inside the carousel is selected scrollbars appear. There is no reason for the scrollbars to appear because everything inside the text block displays correctly. I have tried many things like setting ScrollViewer.CanContentScroll="False" and SelectiveScrollingGrid.SelectiveScrollingOrientation="None". Nothings seems to help. Any idea on what changes I need to make the scrollbars hidden? I have supplied a sample of the code. It only contains one rectangle but once selected you will see the scrollbars appear. Maybe my approach is wrong if so I guess I would need to know the recommended way to add items to carousel list box. Thanks in advance.
Hello Michael,
I have been looking into your issue and my suggestion is to set the width of the Canvas element to “140” instead of “150”. It seems that the width of the canvas is bigger than this one of the carousel item element and it automatically makes scrollbar appears.
Let me know, if this meets your requirements.
Your answer worked but I am a little confused. When you say the item in the carousel are you referring to the rectangle or the textblocks? Do I need to adjust my path or change the settings in the carousel? I would like to adjust the height of the canvas so I can display more text. In this example I set the canvas to 140 like suggested but the height I adjusted to 100. This once again resulted in scrollbars. Does my path need to be adjusted? Should I be doing something different or is there a better approach. On a side note when the item in the carousel is selected is there a way to not change the selected items background and leave it transparent?
Thank you for your feedback. In my previous post I have in mind the Canvas by Item in the XamCarouselListBox. I have been looking into your scenario and the best approach to make the scrollbars not appear is to set the ‘ItemSize’ property of the ViewSettings like e.g. :
<igWindows:XamCarouselListBox.ViewSettings>
<igWindows:CarouselViewSettings ItemSize="150,110"/>
</igWindows:XamCarouselListBox.ViewSettings>
In order to change the background of the selected item I can suggest you handle the ‘SelectionChanged’ event like e.g. :
private void CarouselListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (e.RemovedItems.Count != 0)
(e.RemovedItems[0] as Canvas).Background = Brushes.Transparent;
(e.AddedItems[0] as Canvas).Background = Brushes.Blue;
}
Let me know, if you have any other questions on this matter.
Thanks for your help. This has resolved my issue.
I am just checking if you require any further assistance on the matter.
Thank you for your feedback. I have been looking into your latest issue and if you do not select an item by clicking on it, cycling the carousel does not make the selected item change. I am not sure how the selected item changed when you press the forward button, because when I test it on my side, the ‘SelectionChanged’ event does not fire. Would you please modify your sample in order to demonstrate how the selection changes on pressing the buttons ?
Looking forward to hearing from you.
That is what I needed I couldn't figure out how to change the ItemSize. Thanks for answering all my questions.
When cycling through the items using the forward arrow key all the items cycle correctly and get selected correctly. When I cycle back using the back arrow key the selection keeps the red rectangle selected even though it is currently selected to the Options rectangle. Both items appear to be selected. Is this a bug? It also only seems to happen if I have more than 6 items.
I attached an example that can reproduce the issue. Thanks again.