I'm trying to use Windows 8 desktop application message dialog,
running the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Windows.UI.Popups;
namespace WpfApplication1
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
MessageDialog dialog = new MessageDialog("Hope it will work", "TRY");
await dialog.ShowAsync();
}
}
}
But I get the following exception:
"Element not found. (Exception from HRESULT: 0x80070490)"
Can anyone explain why? and how can I solve this issue?
Note: I added the following properties to csproj file:
<TargetPlatformVersion>8.0</TargetPlatformVersion>
And a reference to "Windows.winmd" to the project references
If you take a look here
http://msdn.microsoft.com/library/windows/apps/BR208674
at the bottom you will see :
Minimum supported client Windows 8 [Windows Store apps only]
If you are not developing a Windows Store App (Windows 8 specific app), but a WPF application, use the MessageBox
(http://msdn.microsoft.com/en-us/library/ms602949.aspx)
I see you have ran into a confusion. 'Windows 8' there is used as 'Windows Store Apps' ('Windows 8 Apps', 'WinRT Apps').
User contributions licensed under CC BY-SA 3.0