How to remove border color of custom button when selected by pressing tab in MAUI UWP?

Lohith K K 120 Reputation points
2023-06-12T06:14:49.2433333+00:00

I have a number of buttons(to achieve the requirement of two corner radius I have added button inside the border) in a page. When I start pressing tab the buttons are highlighted with black border.

Help me to remove that border color.

Below is button in normal state:

image

Below is when I press tab it jumps from entry to button selection:

User's image

Developer technologies | .NET | .NET MAUI
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

Answer accepted by question author
  1. Anonymous
    2023-06-12T09:05:18.37+00:00

    Hello,

    I want to remove the border when I select the button by pressing tab key

    Please open the app.xaml file in the Platforms/Windows/Windows/ folder.

    Then add following styles of <maui:MauiWinUIApplication.Resources> in the <maui:MauiWinUIApplication> tag. Set UseSystemFocusVisuals to false, then this border will be removed.

    <maui:MauiWinUIApplication
        x:Class="MauiButtonBorder.WinUI.App"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:maui="using:Microsoft.Maui"
        xmlns:local="using:MauiButtonBorder.WinUI">
    
    <!--Add following resources-->
    
        <maui:MauiWinUIApplication.Resources>
            <Style TargetType="Button">
                <Setter Property="UseSystemFocusVisuals" Value="False"/>
            </Style>
        </maui:MauiWinUIApplication.Resources>
    
    
    </maui:MauiWinUIApplication>
    

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    1 deleted comment

    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.