I use Carousel control from Microsoft.UWP.Toolkir.Controls https://learn.microsoft.com/en-us/windows/communitytoolkit/controls/carousel
When we're clicking and holding left mouse button, we can swipe item like in tablet, phohe. It's just like "panoramic" scroll.
So, it's work normaly, but when we're holding and moving pointer (or finger in the tablet) on the first and last item we get white "background" (mb offset) of left (first item), right (last item) sides.
When we're moving and item get some (I don't how to check) horizontal offset -> it come back to previous state.
we hold and move first item, left of it we get some offset
Can we get and change this offset or disable this option on first and last item?
Can we get and change this offset or disable this option on first and last item?
Windows Community Toolkit is open source, you could check the Carousel source code.
What you said 'when we're holding and moving pointer (or finger in the tablet) on the first and last item we get white "background" (mb offset) of left (first item), right (last item) sides.' just is normal Manipulation operation. You could see these operations in CarouselPanel.cs.
To achieve your target, you need to do judgement in OnManipulationDelta
, if the selecteditem is first or last item, you could terminate Manipulation like the following:
internal void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
var previousIndex = Carousel.SelectedIndex;
var delta = Carousel.Orientation == Orientation.Horizontal ? e.Delta.Translation.X : e.Delta.Translation.Y;
if ((previousIndex == 0 && delta>0)||(previousIndex==Children.Count-1 && delta<0))
{
return;
}
........
}
The above code just is my simple implementation, if you think it's not good for you, you could change it by yourself.
Then, when you change the source code in Windows Community Toolkit, you would have to compile your custom version for it and add reference to it in your project.