private void ListBoxKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Return || e.Key == Key.Tab)
     {
         e.Handled = true;
         var selection = Files.SelectedItem as string;
         if (selection != null)
         {
             SetInputFileName(selection);
             if (!SelectingDirectories && e.Key == Key.Return && File.Exists(Path.Combine(CurrentDirectory, InputFileName.Text)))
             {
                 OKClicked(null, null);
                 return;
             }
         }
         InputFileName.Focus();
         return;
     }
 }
        /// <summary>
        /// After calling any desired properties, call this routine to display the dialog box.
        /// </summary>
        public new void Show()
        {
            if (CurrentDirectory == null || !Directory.Exists(CurrentDirectory))
            {
                CurrentDirectory = ".";
            }

            if (Instructions != null)
            {
                InstructionParagraph.Inlines.Clear();
                InstructionParagraph.Inlines.Add(Instructions);
            }

            if (HelpAnchor == null)
            {
                HelpHyperlink.Visibility = System.Windows.Visibility.Hidden;
            }

            OutputFileName.Text = Path.GetFullPath(CurrentDirectory) + @"\";
            InputFileTextChanged(null, null);
            InputFileName.Focus();
            ((Window)this).Show();
        }