@@ -55,31 +55,33 @@ protected override void OnApplyTemplate()
55
55
56
56
public void OnItemClicked ( )
57
57
{
58
- if ( _ownerRef is not null &&
59
- _ownerRef . TryGetTarget ( out var breadcrumbBar ) )
58
+ if ( _ownerRef is null ||
59
+ ! _ownerRef . TryGetTarget ( out var breadcrumbBar ) )
60
+ return ;
61
+
62
+ if ( IsEllipsis )
60
63
{
61
- if ( IsEllipsis )
62
- {
63
- // Clear items in the ellipsis flyout
64
- _itemEllipsisDropDownMenuFlyout . Items . Clear ( ) ;
64
+ // Clear items in the ellipsis flyout
65
+ _itemEllipsisDropDownMenuFlyout . Items . Clear ( ) ;
65
66
66
- // Populate items in the ellipsis flyout
67
- for ( int index = 0 ; index < breadcrumbBar . IndexAfterEllipsis ; index ++ )
67
+ // Populate items in the ellipsis flyout
68
+ for ( int index = 0 ; index < breadcrumbBar . IndexAfterEllipsis ; index ++ )
69
+ {
70
+ if ( breadcrumbBar . TryGetElement ( index , out var item ) && item ? . Content is string text )
68
71
{
69
- if ( breadcrumbBar . TryGetElement ( index , out var item ) && item ? . Content is string text )
70
- {
71
- _itemEllipsisDropDownMenuFlyout . Items . Add ( new MenuFlyoutItem ( ) { Text = text } ) ;
72
- }
72
+ var menuFlyoutItem = new MenuFlyoutItem ( ) { Text = text } ;
73
+ _itemEllipsisDropDownMenuFlyout . Items . Add ( menuFlyoutItem ) ;
74
+ menuFlyoutItem . Click += ( sender , e ) => breadcrumbBar . RaiseItemClickedEvent ( item ) ;
73
75
}
74
-
75
- // Open the ellipsis flyout
76
- FlyoutBase . ShowAttachedFlyout ( _itemContentButton ) ;
77
- }
78
- else
79
- {
80
- // Fire a click event
81
- breadcrumbBar . RaiseItemClickedEvent ( this ) ;
82
76
}
77
+
78
+ // Open the ellipsis flyout
79
+ FlyoutBase . ShowAttachedFlyout ( _itemContentButton ) ;
80
+ }
81
+ else
82
+ {
83
+ // Fire a click event
84
+ breadcrumbBar . RaiseItemClickedEvent ( this ) ;
83
85
}
84
86
}
85
87
0 commit comments