Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

disable specific hardware keyboard keys(e.g. Home & End keys) for Xamarin.UWP desktop application

Is it possible to disable specific hardware keyboard keys(e.g. Home & End keys) in Xamarin.UWP application for whole app.

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    You could set Handled depends on the specific keys(Hone/End) in PreviewKeyDown event.

       private void PreviewKeyDown(object sender, KeyRoutedEventArgs e)
        {
    
            if(e.Key == VirtualKey.Home | e.Key == VirtualKey.End){
                   e.Handled = true;
            }
           else{
               e.Handled = false;
           } 
        }
    
Sign In or Register to comment.