How can I disable the arrows on a FlipView?

2019-06-28 01:05发布

问题:

I have a FlipView, which is working great, but I'd like to disable the < and > arrows that fade in while scrolling.

回答1:

I think that would break the scenario for keyboard/mouse users, no?

You could remove the buttons from the control template if you really need to.



回答2:

Here are 2 options.

Option 1. In FlipView.Loaded event dynamically remove the arrow buttons.

private void flipView_Loaded(object sender, RoutedEventArgs e)
{
    Grid grid = (Grid)VisualTreeHelper.GetChild(flipView, 0);
    for (int i = grid.Children.Count - 1; i >= 0; i--)
        if (grid.Children[i] is Button)
            grid.Children.RemoveAt(i);
}

Option 2. Edit the template of the FlipView control (as Filip Skakun said in his answer).