1

I am trying to user a this project which is adapted from the Vista Bridge sample on MSDN http://msdn2.microsoft.com/en-us/library/ms756482.aspx.

      WPFFolderBrowser.WPFFolderBrowserDialog fbd = new     WPFFolderBrowser.WPFFolderBrowserDialog();
      fbd.Title = "Title";
      fbd.InitialDirectory = Environment.CurrentDirectory;

            if (fbd.ShowDialog() == true)
                {
                }

All goes fine but i just want to center the browsing window and can't seem to find the needed property for this. If anyone has used it or knows about it, please give me a hint !

Olaru Mircea
  • 2,570
  • 26
  • 49
  • 1
    If you're not afraid of a little P/invoke, then Hans Passant has your answer: http://stackoverflow.com/questions/2576156/winforms-how-can-i-make-messagebox-appear-centered-on-mainform – DonBoitnott Feb 12 '15 at 18:27

1 Answers1

0

The short answer is that WPFFolderBrowser doesn't expose that functionality.

The longer answer is that due to the power of open source you can edit WPFFoldererBrowser.ShowDialog() to do what you want. The line you care about is

int hresult = nativeDialog.Show(GetHandleFromWindow(parentWindow));

You need to:

  1. pull out the GetHandleFromWindow(parentWindow) portion
  2. get the window handle pointer
  3. follow the instructions in the MSDN dialog box positioning documentation, (Using SetWindowPos in C# to move windows around will help you translate from the native code in the MSDN documentation to the managed code you want)
Community
  • 1
  • 1
NextInLine
  • 2,126
  • 14
  • 23