Reputation: 4718
I'm using a XAML FlipView Control for a Windows 8 store application.
When I use the mouse and the mouse is over the FlipView control the previous/next navigation buttons are shown.
However if I don't use a mouse and use touch, the navigation buttons hide.
I would like navigation buttons to always be visible. How can I do this?
I've looked at the control template but I can't see anything in there that sets the visibility of the navigation buttons.
Ta
Upvotes: 3
Views: 2303
Reputation: 59
Try dynamically hide/show the buttons.
private void Show(object sender, RoutedEventArgs e)
{
ButtonShow(fv, "PreviousButtonHorizontal");
ButtonShow(fv, "NextButtonHorizontal");
ButtonShow(fv, "PreviousButtonVertical");
ButtonShow(fv, "NextButtonVertical");
}
private void Hide(object sender, RoutedEventArgs e)
{
ButtonHide(fv, "PreviousButtonHorizontal");
ButtonHide(fv, "NextButtonHorizontal");
ButtonHide(fv, "PreviousButtonVertical");
ButtonHide(fv, "NextButtonVertical");
}
private void ButtonHide(FlipView f, string name)
{
Button b;
b = FindVisualChild<Button>(f, name);
b.Opacity = 0.0;
b.IsHitTestVisible = false;
}
private void ButtonShow(FlipView f, string name)
{
Button b;
b = FindVisualChild<Button>(f, name);
b.Opacity = 1.0;
b.IsHitTestVisible = true;
}
private childItemType FindVisualChild<childItemType>(DependencyObject obj, string name) where childItemType : FrameworkElement
{
// Exec
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(obj, i);
if (child is childItemType && ((FrameworkElement)child).Name == name)
return (childItemType)child;
else
{
childItemType childOfChild = FindVisualChild<childItemType>(child, name);
if (childOfChild != null)
return childOfChild;
}
}
return null;
}
Upvotes: 2