public CustomMessage(string msg) { message = new CustomDialog(); messageGrid = new Grid(); messageGrid.Width = 700; messageGrid.Height = 150; bnt = new Button(); txt = new TextBlock(); txt.Text = msg; bnt.Content = "OK"; bnt.Width = 100; txt.FontSize = 20; bnt.HorizontalAlignment = HorizontalAlignment.Center; bnt.VerticalAlignment = VerticalAlignment.Center; txt.HorizontalAlignment = HorizontalAlignment.Center; txt.VerticalAlignment = VerticalAlignment.Top; messageGrid.Children.Insert(0, txt); messageGrid.Children.Insert(1, bnt); message.Content = messageGrid; message.ShowDialogExternally(); bnt.Click += new RoutedEventHandler(OnOkClicked); }
private async void ShowDialogOutside(object sender, RoutedEventArgs e) { var dialog = new CustomDialog(this.MetroDialogOptions) { Content = this.Resources["CustomDialogTest"], Title = "This dialog allows arbitrary content." }; dialog = dialog.ShowDialogExternally(); await Task.Delay(5000); await dialog.RequestCloseAsync(); }
protected override void OnStartup(StartupEventArgs e) { if (e is null) { throw new ArgumentNullException(nameof(e)); } base.OnStartup(e); var dialog = new CustomDialog() { Title = "This dialog allows arbitrary content." }; dialog.ShowDialogExternally(); }