如何更新窗口? [英] How to update window?

查看:122
本文介绍了如何更新窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个日记程序(用于学校项目),它包含一个带有标签控件的主窗口(3个标签分别用于日历,每周和列表视图).主窗口有一个新任务"按钮,可打开一个任务输入窗口.在任务输入窗口中,可以通过按钮保存任务.我希望主窗口进行更新以包括新保存的任务,但是不确定要执行的操作包括什么.

简化当前设置:

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()};
    }
}

解决方案

hi gabe

要更新主窗口,请在主窗口的"mouseenter"事件中写入更新代码.


 私有 无效 MainWindow_MouseEnter(对象发​​件人,EventArgs e)
      {
       // 实现您的逻辑听到
      }



谢谢与问候
Sandeep


保存后,将数据重新绑定到主窗口的网格中.

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()};
    }
}

解决方案

hi gabe

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


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



Thanks&Regards
Sandeep


After save rebind the data in your grid in main window..


这篇关于如何更新窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆