A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
Hello,
How to disable selection in windows?
You can do this by Handler. You can get Microsoft.UI.Xaml.Controls.TextBox control
Attach to the SelectionChanging event and the SelectionLength = 0; and that will stop the selection from occurring.
Microsoft.Maui.Handlers.EditorHandler.Mapper.AppendToMapping("MyCustomization", (handler, view) =>
{
#if WINDOWS
if (view.IsReadOnly)
{
Microsoft.UI.Xaml.Controls.TextBox res = handler.PlatformView;
res.SelectionChanging += (o, e) =>
{
res.SelectionStart = 0;
};
}
#endif
});
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.