Click here to Skip to main content
15,846,826 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I habe in my WPF-App a PopUpControl with a OpenFileDialog function (var dialog = new System.Windows.Forms.OpenFileDialog()).

It works fine, but:
The FileOpenDialog is in the Background.
And the PopUpControl is in the foreground.
Therefore, the User can not see the OpenFileDialog.

How can i put the OpenFileDialogin the foreground???


markovl 19-May-11 8:47am    
Deleted my answer... Brain fart.
Is the OpenFileDialog set as Child of the Popup? What is your setup?

1 solution

Well I tried and here is my code for this:
XAML File looks like that:
<Window x:Class="WpfApplication2.Window1"
    Title="Window1" Height="300" Width="300" MouseEnter="Window_MouseEnter">
      <Popup x:Name="PopupTest" AllowsTransparency="True" Opened="PopupTest_Opened" MouseDown="PopupTest_MouseDown">
         <Viewbox VerticalAlignment="Top">
            <TextBlock Text="WWW">


And the cs file is the following:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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 Microsoft.Win32;

namespace WpfApplication2
   /// <summary>
   /// Interaction logic for Window1.xaml
   /// </summary>
   public partial class Window1 : Window
      public Window1()

      private void Window_MouseEnter(object sender, MouseEventArgs e)
         PopupTest.Placement = System.Windows.Controls.Primitives.PlacementMode.Mouse;
         PopupTest.StaysOpen = false;
         PopupTest.Height = 1000;
         PopupTest.Width = 500;
         PopupTest.IsOpen = true;

      private void PopupTest_Opened(object sender, EventArgs e)
         //var dialog = new OpenFileDialog();

      private void PopupTest_MouseDown(object sender, MouseButtonEventArgs e)
         var dialog = new OpenFileDialog();


And the openfiledialog is displayed in the foreground :-).
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900