Projekt-Anfragen: Tel: 07022/9319004 info@CodeDocu.de Software Entwicklung in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net
#

UWP: Messagebox in Universal App anzeigen

Problem: Wie zeigt man eine Message, Messagebox in einer Universal Windows App an?


In der Datei muss man die Windows.UI.Popups als Namespace einbinden:
using Windows.UI.Popups;

so ruft man die Messagbox zum Anzeigen einer Fehlermeldung auf:

MessageDialog dialog = new MessageDialog("could not open the folder?", "Information");
await dialog.ShowAsync();


die Meldung sieht dann so aus:



Hier ein Codebeispiel
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

namespace NavigationMenuSample.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class CommandBarPage : Page
{
public CommandBarPage()
{
this.InitializeComponent();
}

private void Button_Click(object sender, RoutedEventArgs e)
{

}

private async void BtnFolderPicker_Click(object sender, RoutedEventArgs e)
{
//if (rootPage.EnsureUnsnapped())
//{
FolderPicker folderPicker = new FolderPicker();
folderPicker.SuggestedStartLocation = PickerLocationId.Desktop;
//folderPicker.FileTypeFilter.Add(".jpg");
StorageFolder folder = await folderPicker.PickSingleFolderAsync();
if (folder != null)
{
// Application now has read/write access to all contents in the picked folder (including other sub-folder contents)
//StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", folder);
tbxFolder.Text = folder.Name;
}
else
{
MessageDialog dialog = new MessageDialog("could not open the folder?", "Information");
await dialog.ShowAsync();
}
//}

}
}
}
Mobile
»
UWP: List als sortierbares Text-Array
»
UWP: Transparentes Rahmenloses Fenster
»
UWP Debug: Einschalten des Native Code Debugging
»
UWP: Wert von Setting auslesen
»
UWP: FontIcon Glyph Codes Symbol Icon Codes
»
UWP: ContactManager ShowContactCard
»
UWP: Gridlength auto oder star
»
WPF, UWP: Keyboard Taste Key vergleichen
»
UWP: Wie kann man diese Nummern in der Universal App ausschalten
»
UWP: Den dargestellten Rahmen der einzelnen Elemente, Kacheln in einen Grid ändern

.

Jobs, Projekte, Angebote für Freiberufler, Selbstständig an Info@CodeDocu.de