コード例 #1
0
        /// <summary>
        /// Instantiate a new <see cref="PopupTappedEventArgs"/>
        /// </summary>
        /// <param name="popup">The popup that was tapped</param>
        /// <param name="view">The view that was tapped</param>
        /// <returns></returns>
        public static PopupTappedEventArgs Create(Popup popup, View view)
        {
            PopupSectionType housingSectionType;

            var parentView = view.FindParent(ve =>
            {
                var parentSectionType = ve.GetValue(Popup.SectionTypeProperty);
                var currentSection = (PopupSectionType)parentSectionType;

                return currentSection == PopupSectionType.Body
                       || currentSection == PopupSectionType.Footer
                       || currentSection == PopupSectionType.Header;
            });

            if (parentView == null)
            {
                housingSectionType = PopupSectionType.Backdrop;
            }
            else
            {
                housingSectionType = (PopupSectionType)parentView.GetValue(Popup.SectionTypeProperty);
            }

            var controlType = (PopupSectionType)view.GetValue(Popup.SectionTypeProperty);
            var evt = new PopupTappedEventArgs
            {
                Popup = popup,
                ControlTapped = view,
                IsUserControl = controlType == PopupSectionType.NotSet,
                Section = housingSectionType
            };

            return evt;
        }