after click on the button present in "MainWindow" ,i'm exporting some data into one file.
i want to close the MainWindow after completion of my exporting function....
how to do it....
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Nov 4, 2014, 1:53 AM EST
Yadagiri ReddyRank #773 · 3K reputationPosted Nov 4, 2014, 2:00 AM EST
this.Close() doesn't work here.
tel me how to handle from viewmodel.
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Nov 4, 2014, 2:43 AM EST
Then you have to use Command.
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
Content="Close Window" />
private void CloseCommandHandler(object sender, ExecutedRoutedEventArgs e)
{
this.Close();
}
Yadagiri ReddyRank #773 · 3K reputationPosted Nov 4, 2014, 4:09 AM EST
below is my sample code
[XAML]
Title="ExportData" Height="600" Width="1000">
MessegeBox.Show("Exported Successfully");
// here i want the code for closing main window