开发者

how to pass button_click to child window in C#?

开发者 https://www.devze.com 2022-12-17 17:10 出处:网络
Can anyone here do me a favor? I have a MainWindow with a HideButton and RetrieveButton. When I click on either one button, it will 开发者_如何学Pythongoes to another ChildWindow. My ChildWindow have

Can anyone here do me a favor?

I have a MainWindow with a HideButton and RetrieveButton. When I click on either one button, it will 开发者_如何学Pythongoes to another ChildWindow. My ChildWindow have a OKButton.

The question here, How to set if else statement in C# for pseudocode below?

private void OKButton_Click(object sender, EventArgs e)
{
    // pseudocode
    if (HideButton in MainWindow is clicked)
    {
        // Perform the works
    }

    if(RetrieveButton in MainWindow is clicked)
    {
        // Perform other works
    }

Thanks in advance.

By, Aeris


If you are creating the child window on Retrieve or Hide you can easily pass parameters then either via the constructor or by setting a custom property:

ChildWindow child = new ChildWindow();
child.Retrieving = true;
child.Show();
0

精彩评论

暂无评论...
验证码 换一张
取 消