locked
PickerFlyoutBase CRITICAL bug, Unloaded event fired unexpectedly

    Question

  • I created a picker inheriting PickerFlyoutBase.

        public class CustomPicker : PickerFlyoutBase
        {
            protected override bool ShouldShowConfirmationButtons()
            {
                return false;
            }
            protected override Windows.UI.Xaml.Controls.Control CreatePresenter()
            {
                var pickerContentContainer = new ContentControl { HorizontalContentAlignment = HorizontalAlignment.Center, VerticalContentAlignment = VerticalAlignment.Stretch };
                var pickerContent = new PickerContent();
                pickerContentContainer.Content = pickerContent;
                pickerContent.Unloaded += (s, e) =>
                    {
    
                    };
                return pickerContentContainer;
            }
        }
    

    When the picker is opened the Unloaded event is fired, which makes no sense because the unloaded element is what is being displayed.

            private void Button_Click(object sender, RoutedEventArgs e)
            {
                var picker = new CustomPicker();
                picker.ShowAt(sender as Button);
            }
    

    Is there any workaround?

    Regards,

    Alvaro.


    Alvaro Rivoir

    Sunday, September 28, 2014 12:49 AM

All replies

  • I'm looking into this. Please bump if you don't hear from me in a couple of days.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, September 29, 2014 8:48 PM
    Moderator
  • Any news?

    Alvaro Rivoir

    Thursday, October 02, 2014 4:51 PM
  • Yes... what's a PickerContent object?  It doesn't resolve and it's not on MSDN that I can find.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, October 02, 2014 7:30 PM
    Moderator
  • Hi Matt,

    It's any Control, if you want you can create a user control with that name.

    Regards,

    Alvaro.


    Alvaro Rivoir

    Thursday, October 02, 2014 8:05 PM
  • Please provide a project so I can look into it.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, October 08, 2014 6:22 PM
    Moderator