3
Reply

Filename is empty in SaveDialogue

Ask a question
Yoko Yoko

Yoko Yoko

9y
506
1
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)