Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Im creating a diary program (for school project) and it consists of a main window with a tab control (3 tabs for different calendar, weekly and list views). The main window has a "New Task" Button which opens a task entry window. On the task entry window, tasks can be saved via a button. I would like the main window to update to include the newly saved task, but am unsure what to include to do this.

Simplification of current setup:
public class MainWindow : Window
{
    public MainWindow()
    {
        //Grid containing tasks
        Button newTask = new Button();
        Button.Click += delegate{new TaskWindow(); };
    }
}

public class TaskWindow : Window
{
    public TaskWindow()
    {
        //Data entry
        Button save = new Button();
        //Save() = function to save
        Button.Click += delegate{Save()};
    }
}
Posted

hi gabe

for updating main window, write the update code in on "mouseenter" event of main window.


C#
private void MainWindow_MouseEnter(object sender, EventArgs e)
      {
       //implement your logic hear
      }


Thanks&Regards
Sandeep
 
Share this answer
 
Comments
Gabe Low 17-Jul-12 7:14am    
THANKS! It wasn't a solution I was expecting, but it works well.
sandeep nagabhairava 17-Jul-12 7:16am    
thanks, you welcome
After save rebind the data in your grid in main window..
 
Share this answer
 
Comments
Gabe Low 17-Jul-12 7:15am    
Thanks for the help!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900