Standard Control Events

The following table lists and describes standard control events.

Note: A control should be available before subscribing to its events. It is possible to subscribe to an event of a given control only if the control has already been bound.

Event

Notes

PropertyChanged

Supported by all controls.

Clicked

Supported by Button control (and all future invokable controls).

WindowOpened

Supported by all windows.

WindowClosed

Supported by all windows.

SelectionChanged

Supported by Selectable class, which is used by the RadioButton and TabItem controls.

Invoked

Can be registered on all UI elements that support the Invoke pattern. Represents controls that initiate or perform a single, unambiguous action and do not maintain state when activated. Such controls can be menu items, buttons, etc.

tog_minusExamples

Example 1:

protected virtual void WindowOpened(object sender, EventArgs e)

        {

            if (sender is StandardControls)

            {

                ++Counter;

                _stdWnd = sender as StandardControls;

 

                _stdWnd.SpinBoxTabItem.Select();

                _stdWnd.SpinBoxTabItem.SetButton.Clicked += SetButton_Clicked;

                _stdWnd.SpinBoxTabItem.SetButton.Click();

            }

        }

 

        void SetButton_Clicked(object sender, EventArgs e)

        {

 

Loggers.EventsLogger.Info("Standard::ButtonClickedEvent::SetButton_Clicked");

            _stdWnd.SpinBoxTabItem.SetButton.Clicked -= SetButton_Clicked;

            SetResult(ButtonClickedEvent.Success);

        }

Example 2:

protected override void WindowOpened(object sender, EventArgs e)

        {

            if (sender is StandardControls)

            {

                ++Counter;

                _stdWnd = sender as StandardControls;

                _stdWnd.WindowOpened += this.WindowOpened;

 

                _stdWnd.FileMenuItem.OpenMenuItem.Pick();

 

            }

            else if (sender is StandardControls.OpenWindow)

            {

                ++Counter;

                _stdDlgWnd = ((StandardControls.OpenWindow)sender);

                _stdDlgWnd.WindowClosed += this.stdWnd_WindowClosed;

                _stdDlgWnd.CancelButton.Click();

            }

        }

 

        void stdWnd_WindowClosed(object sender, EventArgs e)

        {

            _stdDlgWnd.WindowClosed -= this.stdWnd_WindowClosed;

            SetResult(++Counter);

        }