I have created a C# desktop application using WPF for sending a toast notification. I am using my own custom audio to play when the toast notification gets displayed. I found some problems where my custom sound is not getting played when the notification window is popped out.
I have used the following code to add custom audio to my notification.
bool supportsCustomAudio = true;
if (AnalyticsInfo.VersionInfo.DeviceFamily.Equals("Windows.Desktop")
&& !ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 2))
{
supportsCustomAudio = false;
}
if (supportsCustomAudio)
{
notificationBuilder.AddAudio(new Uri("ms-appx:///Assets/Audio/customaudio.mp3"));
}
Am I missing something? Could someone please help me with the issue?
ms-appx:///is known not to work in WPF and according to Custom audio on toasts, onlyms-appx:///andms-resourceare supported. So I am skeptical that you could use it in WPF.ms-appx:///in other part of your WPF app?ms-appx:///does not work in WPF.