Refresh the parent window after WPF or WinForm closes a child window or a child window

Source: Internet
Author: User

Parent window:<summary>
Pop-up window
</summary>
<param name= "Sender" ></param>
<param name= "E" ></param>
Privatevoid Mifuncset_click (object sender, RoutedEventArgs e)
{
Winfuncsetting funcsetting =new winfuncsetting ();
Funcsetting.changetextevent +=new Changetexthandler (funcsettingclosed);
Funcsetting.showdialog ();
}
To set the method to execute when the window is closed
void Funcsettingclosed ()
{//write the method you want to invoke, such as rebind the data source, change the value of a tag, etc.}child window:Namespace EFM. Functest.assist
{
Defining delegates
Publicdelegatevoid Changetexthandler ();
<summary>
The interactive logic of Funcsetting.xaml
</summary>
Publicpartialclass Winfuncsetting:window
{
Publicevent Changetexthandler changetextevent;
Public winfuncsetting ()
{
InitializeComponent ();
}//Window Close Event you can trigger the event after any action you need, and I'm here to write it down in the window.
Privatevoid window_closed (object sender, EventArgs e)
{
Strikeevent ();
}
Trigger event changes the value of MainWindow
Privatevoid strikeevent ()
{
if (changetextevent!=null)
{
Changetextevent ();
}
}}

Refresh the parent window after WPF or WinForm closes a child window or a child window

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.