M
M
Michael2016-08-17 11:21:50
WPF
Michael, 2016-08-17 11:21:50

Why does WPF use this way of specifying event handling?

Standard solution. It is also used in android and java:

class Element
{
    public event EventHandler Click;
    protected void OnClick(EventArgs e)
    {
        Click?.Invoke(this, e);
    }
}

But why is this added to wpf for the UI event handler:
private void Window_Deactivated(object sender, EventArgs e)
        {
            ....
        }

Question: Why exactly, and not as in the first option?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vyacheslav Zolotov, 2016-08-17
@SZolotov

Read about delegates and understand what Click?.Invoke(this, e);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question