• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 996
  • Last Modified:

SaveFileDialog (Silverlight 4) - Filter

I´m using filter in SaveFileDialog, but it not appear when I show the dialog box.
What is wrong?

Thanks.



  private void btnDownload_Click(object sender, System.Windows.RoutedEventArgs e)

        {
            SaveFileDialog saveDialog = new SaveFileDialog();
            saveDialog = new SaveFileDialog();

            saveDialog.DefaultExt = ".txt";
            saveDialog.Filter = "Text Files|*.txt|Log Files|*.log|All Files|*.*";
            saveDialog.FilterIndex = 2;  


            if (saveDialog.ShowDialog() == true)
            {
                System.IO.Stream fileStream = saveDialog.OpenFile();
                System.IO.StreamWriter sw = new System.IO.StreamWriter(fileStream);
                sw.Write(Retorno);
                sw.Flush();
                sw.Close();
            }
        }
Image1.jpg
0
Plexo
Asked:
Plexo
  • 2
2 Solutions
 
lenordisteCommented:
your code looks fine. I tested it and it does show all 3 filter types. Can you try running your code on another PC and see if the problem still occurs?
0
 
politexCommented:
it's works, you are sure what filter's string at page exact as in your code, possible anything symbol was eaten by parser?
0
 
PlexoAuthor Commented:
The problem was in my computer.
Thanks for the help.

In Time..

Is there the possibility of a default file name in Dialog box too?
0
 
politexCommented:
I think this is denied, because insecure.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now