Example #1
0
        private static Behavior CreateAppearingEventToCommandBehavior(VisualElement view)
        {
            var behavior = new EventToCommandBehavior {
                EventName = nameof(ContentPage.Appearing)
            };

            view.BindingContextChanged += (s, e) =>
            {
                behavior.SetBinding(CommandProperty, new Binding(nameof(BaseViewModel.AppearingCommand))
                {
                    Source = view.BindingContext
                });
            };

            return(behavior);
        }