I have a uwp flipview, and want to get it to show a bit of the next and previous elements. Essentially, this means make each flipviewitem slightly smaller, so that you know that the flipview can be scrolled across. Here's a screenshot of what I currently have:
The flipview is the part with the circular image of Michael Fassbender. You can swipe to the next one, so I want to show a bit of the next image to the left. I've noticed that the FlipView default style has an ItemsPresenter inside a scrollviewer (we can modify a FlipView default style by right click it in Visual Studio/Edit Style/Edit a Copy ...). If I set the margin of that ItemsPresenter to say -100 on each side, it works at some points, but the behavior is weird, unpredictable, and depends of the window's width. What other solution would there be?
You are right about setting the
Margin
of thatItemsPresenter
, but I think the value of -100 can't solve the problem here, and it should depends on theFilpView
's width, not the window's width. Here I have a solution also setting theMargin
property:And my converter is like this:
As you can see from this code, I set the width of each item to 2/3 of the whole
FlipView
's width and keep the left and right sides have a space with 1/6 of theFlipView
's width, so will the next, current and previous elements be shown together.And since I bind the value of
Margin
toWidth
, when usingFlipView
now, theWidth
property should be set. You said it depends on the window's size, I guess that you want yourFlipView
's width equal with the window's width, so for example you can code like this:The code behind for the
CustomWidth
is like this:Here is the rendering image of this demo: