I noticed that expander has two events: Expanding and Collapsed that are named differently.
|
event Windows.Foundation.TypedEventHandler<Expander, ExpanderExpandingEventArgs> Expanding; |
|
event Windows.Foundation.TypedEventHandler<Expander, ExpanderCollapsedEventArgs> Collapsed; |
Expanding implies the event is fired before the control is expanded and Collapsed implies after. Therefore, a difference in naming here concerned me so I went to check the code. Sure enough, there seems to be a mismatch. According to the code below all events are fired BEFORE the is expanded state is applied meaning both events should be named with a 'ing' suffix. Is my understanding correct here? If so this is actually a bug.
|
void Expander::OnIsExpandedPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& /*args*/) |
|
{ |
|
if (IsExpanded()) |
|
{ |
|
RaiseExpandingEvent(*this); |
|
} |
|
else |
|
{ |
|
RaiseCollapsedEvent(*this); |
|
} |
|
UpdateExpandState(true); |
|
} |
The differences in naming is actually quite important as in the future four events should be added to cancel expanding/collapsing. #3279 (comment). There should be four total events in the end:
- Expanding <- Can cancel
- Expanded
- Collapsing <- Can cancel
- Collapsed
I noticed that expander has two events:
ExpandingandCollapsedthat are named differently.microsoft-ui-xaml/dev/Expander/Expander.idl
Lines 30 to 31 in 4208a01
Expandingimplies the event is fired before the control is expanded andCollapsedimplies after. Therefore, a difference in naming here concerned me so I went to check the code. Sure enough, there seems to be a mismatch. According to the code below all events are fired BEFORE the is expanded state is applied meaning both events should be named with a 'ing' suffix. Is my understanding correct here? If so this is actually a bug.microsoft-ui-xaml/dev/Expander/Expander.cpp
Lines 104 to 115 in 4208a01
The differences in naming is actually quite important as in the future four events should be added to cancel expanding/collapsing. #3279 (comment). There should be four total events in the end: