0
votes

I want to display custom text or control on the Windows 10 Lockscreen, when I click on a button. I tried it with an UWP Application.

My goal is something like this: https://i.stack.imgur.com/edpj7.png

And the Code I tried:

ToastContent content = new ToastContent()
            {
                //Duration = ToastDuration.Long,
                Scenario = ToastScenario.Reminder,
                Visual = new ToastVisual()
                {
                    BindingGeneric = new ToastBindingGeneric()
                    {
                        Attribution = new ToastGenericAttributionText()
                        {
                            Text = "Hello World"
                        }
                    }
                },
                Actions = new ToastActionsCustom()
                {
                    Buttons = {
                new ToastButton ("mycontent", "myargs")
            }
                }
            };
            var notification = new ToastNotification(content.GetXml());
            ToastNotificationManager.CreateToastNotifier().Show(notification);

Also I saw this post and tried it of course, but it wasnt helpfull: Windows Lock Screen display text programmatically C#

Maybe you could help me to achive my goald I thank you in advance

I was able to get this to work in a UWP project using the code you posted. In your Windows settings (Notifications & actions), make sure you have "Get notifications from apps and other senders" and "Show notifications on the lock screen" turned on. - Jesse
@Jesse Thank you for your answer. Everything is turned on, but it still doesnt work :/ - wpferr19
@Jesse if I click on the Button, the Notification is shown up but thats not my goal, I want to see something in the Lock Screen if I click on the Button and Lock my PC. I want something like Spotify or the Time and Date. - wpferr19