Disable focus on Pivot

Viewed 218

I want to disable tab navigation on a Pivot control as my control is already handling tabs. I have tried many approaches such as setting IsTabStop=false and removing focus on GotFocus event like this

mPivot->GotFocus += ref new RoutedEventHandler([](Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) { mPivot->Focus(Windows::UI::Xaml::FocusState::Unfocused); });

But this results in crash with The parameter is incorrect. What should be the official way to do this? Also, how to achieve similar thing for a ListView?

EDIT: I found a hackish way to fix the crash: Instead of forcing Unfocused on the Pivot, I should artificially put focus on my control.

mPivot->GotFocus += ref new RoutedEventHandler([](Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
    mControl->Focus(Windows::UI::Xaml::FocusState::Programmatic);
});
1 Answers
Related