Yoko Yoko

Yoko Yoko

  • NA
  • 12
  • 4.2k

Filename is empty in SaveDialogue

May 19 2015 4:12 AM
I am trying to save a xml file generated in the code using Savedialogue.
I have given the following code in my click button command.
 
var saveDialog = new Microsoft.Win32.SaveFileDialog()
{
Filter = "Loan Parameters(*.xml)|"
};
if (saveDialog.ShowDialog() == false)
{
return;
}
 
// XML Serialization and Binary Encoding
byte[] buffer = LoanDataHelper.SerializeModel(loanParameterValueConfig);
if (buffer != null)
{
LoanDataHelper.WriteStreamToFile(buffer, saveDialog.FileName, LoanDataHelper.FileFormat.Normal);
}
 
I am using mvvm model  .On running I am getting exception as filename is not getting the value that I am passing in the savedialogue window.It is always empty string. 
 
I could not figure out what i am missing here.
Please help.
Thanks in advance
 
 
 
 

Answers (3)