question

59045896 avatar image
0 Votes"
59045896 asked HuiLiu-MSFT edited

How to use uwp-uri in WPF app?

My WPF app needs notification of win10 style , so I used Microsoft.Toolkit.Uwp.Notifications --NuGet package. But the picture of AppLogoOverride cannot be replaced ,because the schema of AppLogoOverride Uri only 3 types( http:// ms-appx:///
ms-appdata:///) can be used. How to use uwp-uri in WPF app? Or how to replace the picture of AppLogoOverride in another way?
Excuse me ,I’m not good at English .

windows-wpf
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

HuiLiu-MSFT avatar image
1 Vote"
HuiLiu-MSFT answered HuiLiu-MSFT edited

I created Wpf Application (.Net Core 3.1) and downloaded and installed the package Microsoft.Toolkit.Uwp.Notifications.Then I use the following code to display the Notification with picture. You could refer to the following code.
The code of xaml:

 <Grid>
         <Button Click="Button_Click" Width="100" Height="80">click</Button>
 </Grid>

The code of xaml.cs(Button):

   private void Button_Click(object sender, RoutedEventArgs e)
         {
           new ToastContentBuilder().AddArgument("action", "viewConversation")
     .AddArgument("conversationId", 9813)
     .AddText("Ev2 Compiler Library")
     .AddText("Allow sending build Data to Microsoft")
     .AddAppLogoOverride(new Uri(@"C:\Users\userName\Desktop\3.jpg"), ToastGenericAppLogoCrop.Default)
     .Show();
         }

The result is shown in the picture:
122499-pastedimage.png


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.



pastedimage.png (46.2 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,@59045896. Does this solution solve your problem? If so, please accept it as an answer. This will benefit other community members who have similar problems. If not, please tell me your related questions.

0 Votes 0 ·