|
namespace WindowWithMVVM
{
using System.Windows.Controls;
using System.Windows.Navigation;
using WindowWithMVVM.Views;
using System.Windows;
/// <summary>
/// Home page for the application.
/// </summary>
public partial class Home : Page
{
/// <summary>
/// Creates a new <see cref="Home"/> instance.
/// </summary>
public Home()
{
InitializeComponent();
this.Title = ApplicationStrings.HomePageTitle;
}
/// <summary>
/// Executes when the user navigates to this page.
/// </summary>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
private void button1_Click(object sender, System.Windows.RoutedEventArgs e)
{
var window = new ChildWindow1 { DataContext = this.DataContext };
window.Unloaded -= new System.Windows.RoutedEventHandler(ChildWindow_Unloaded);
window.Unloaded += new System.Windows.RoutedEventHandler(ChildWindow_Unloaded);
window.Show();
}
void ChildWindow_Unloaded(object sender, System.Windows.RoutedEventArgs e)
{
//You can do child window closing coding here like collect object, saving samething or changing status
MessageBox.Show("Child window is closed now.");
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.