Home
Do you avoid "UI" in event names?
  v1.0 Posted at 1/05/2018 7:11 AM by Tiago Araujo
No "UI" in event names, the event raiser should be unaware of the UI in MVVM and user controls
The handler of the event should then do something on the UI.

private void RaiseUIUpdateBidButtonsRed()
{
if (UIUpdateBidButtonsRed != null)
{
UIUpdateBidButtonsRed();
}
}

Bad Code: Avoid "UI" in event names, an event is UI un-aware

​​

private void RaiseSelectedLotUpdated()
{
if (SelectedLotUpdated != null)
{
SelectedLotUpdated();
}
}

Good Code: We received an update on the currently selected item, change the UI correspondingly (or even better: use MVVM and data binding)


Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address:

    Comments:

    Note: Social Media login for Yotpo is not working in IE or Safari, please use Chrome. We are waiting for Yotpo to fix it.