質問

I have a WPF UserControl which use the System.Windows.Controls.PrintDialog:

XAML:

<UserControl x:Class="WpfControlLibrary1.UserControl1"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">    
   <Button Click="Button_Click"/>
</UserControl>

CodeBehind:

namespace WpfControlLibrary1
{
   using System.Windows;
   using System.Windows.Controls;

   public partial class UserControl1 : UserControl
   {
      public UserControl1()
      {
         InitializeComponent();
      }

      private void Button_Click(object sender, RoutedEventArgs e)
      {
         var printer = new PrintDialog();
         printer.ShowDialog();
      }
   }
}

If I use now this UserControl in a WPF Appplication the PrintDialog-Windows appears as modal dialog. (Like described in msdn)

But if I use the UserControl in a Wondows-Forms application, the dialog appears as a NON-Modal dialog.

Anyone an idea how I can call the PrintDialog as modal dialog when I host the usercontrol in a Windows-Forms application?

Thanking you in anticipation rhe1980

役に立ちましたか?
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top