Why does a behavior’s CommandParameter or bound item become null or outdated after refreshing or replacing ItemsSource?

CollectionView recycles its item containers. When ItemsSource changes, existing visuals may be reused before new bindings are applied. Behaviors that cached item references when they were first attached will then reference stale or null objects. Fix: Use bindings based on the current BindingContext (such as {Binding .}), avoid storing item references inside the behavior, and reapply or update behaviors when containers are reused.

Do behaviors automatically inherit the BindingContext inside a CollectionView DataTemplate?

In .NET MAUI, behaviors inside a CollectionView DataTemplate usually inherit the BindingContext of the templated view. However, container recycling and platform differences can cause behaviors to receive outdated contexts. Best practice: Explicitly bind the behavior (BindingContext=”{Binding .}” or with RelativeSource), or assign the BindingContext inside OnAttachedTo to ensure reliability.

How can icons be displayed on menu items?

MenuFlyoutItem and MenuFlyoutSubItem inherit the IconImageSource property from Menu Item, which enables a small icon to be displayed next to the text for a context menu item. This icon can be an image or a font XAML