I am using C# WPF .net 4.8.1.
I want to show a notification Toast with my app and so far everything works as intended, but one little, but important, thing:
There is a Dev-Debug as Title not what I thought (Header Title) would be shown. And even worse, the documentation states, that where this Dev-Debug is shown would be the "Attribution Area". But even the AttributionText is not shown where I want it. And when I click on the notifications area in Windows it looks like this:
So the Dev-Debug is used as some kind of grouping item where all toasts are put together. But I wanted only a simple one with the name of my application and a simple message.
This is my code: App.xaml.cs:
ToastNotificationManagerCompat.OnActivated += toastArgs =>
{
ToastArguments args = ToastArguments.Parse(toastArgs.Argument);
ValueSet userInput = toastArgs.UserInput;
Current.Dispatcher.Invoke(delegate
{
MessageBox.Show("Toast activated. Args: " + toastArgs.Argument);
});
};
And the toast itself:
public Toast()
{
ToastContentBuilder test = new ToastContentBuilder();
test.AddAttributionText("TestAttributionText");
test.AddHeader(Guid.NewGuid().ToString(),"TestHeaderTitle", "TestHeaderArgument");
test.AddArgument("TestKey", "TestValue");
test.AddText("TestText");
test.Show(toast =>
{
toast.ExpirationTime = DateTime.Now.AddDays(2);
});
}
Has someone an idea how to show just a simple header with a simple text?
You might not see this in older versions of Windows, but the app's name (which I guess is the "Dev-Debug" in your case) and icon are always displayed in the attribution area on Windows 11. You cannot remove it.
This is documented here.