How to trigger buttons after typing something with enter in toast notifications uwp

Alumni Comp 16 LAXMI SWAMI 46 Reputation points
2021-01-28T11:48:19.963+00:00

In quick reply toast notification if i write a quick reply and want to send it, I have to to press reply after having typed, is it possible to make 'Enter' trigger that button?

Also is it possible to disable a button once the user types anything in the reply textbox?

Developer technologies Universal Windows Platform (UWP)
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. AryaDing-MSFT 2,916 Reputation points
    2021-01-29T06:01:16.753+00:00

    Hi,

    Welcome to Microsoft Q&A!

    Windows toast notifications use Ctrl+Enter to perform the quick reply and use Enter to add a new line.
    Currently, uwp does not provide a way to change it.

    Update:
    ToastButton.TextBoxId can get or set the ID of an existing ToastTextBox in order to have this button display to the right of the input, achieving a quick reply scenario.

    So, this quick reply function depends on you using ToastButton.TextBoxId to make the button behave as a quick reply button. You could set the same Id for the textbox and the button.

    For example(ToastButton.TextBoxId and ToastTextBox.Id in the code below are the same, both are "tbReply"):

      ToastActionsCustom actions = new ToastActionsCustom()  
                {  
                    Inputs =  
                    {  
                        new ToastTextBox("tbReply")  
                        {  
                            PlaceholderContent = "Type a response"  
                        }  
                    },  
      
                    Buttons =  
                   {  
                        new ToastButton("Reply", new QueryString()  
                        {  
                            { "action", "reply" },  
                            { "conversationId", conversationId.ToString() }  
      
                        }.ToString())  
                        {  
                            ActivationType = ToastActivationType.Background,  
                            ImageUri = "Assets/Reply.png",  
                            // Reference the text box's ID in order to quick reply  
                           TextBoxId = "tbReply"  
                        },  
    
                  ……  
               }  
            };  
    

    If the response is helpful, please click "Accept Answer" and upvote it.

    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.


Your answer

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