locked
Catastrophic failure when adding help flyout in settings RRS feed

  • Question

  • Hi,

    I've created a user control to display a help flyout in the settings. I want to make it accessible on all pages in my app. Thus, I declared all the required event handlers in the App.xaml.cs. However, I'm getting a "Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))" error when I run the app.

    The error occurred at the bold line below:

    public App()
    {
        this.InitializeComponent();
        this.Suspending += OnSuspending;
        _windowBounds = Window.Current.Bounds;
        Window.Current.SizeChanged += OnWindowSizeChanged;
    }

    I figured that perhaps I can't declare this in the App.xaml.cs page which causes the error to occur.

    Can anyone tell me what went wrong?

    Thanks.

    Wednesday, September 11, 2013 3:43 AM

Answers

  • Hello,

    Thanks for your response. The example that I have shared previously is how to add a link of the help menu under the setting charm. However if you don’t need to add that inside the setting charm then you can have a custom flyout. Please see the guideline for the flyout as follows,

    http://msdn.microsoft.com/en-us/library/windows/apps/hh465341.aspx

    Thanks

    Saswati


    Saswati Sanyal Blog : http://saswatisanyal.blogspot.com/

    Friday, September 13, 2013 4:24 AM

All replies

  • Can anyone help me out?

    I'm in deep need in finding a solution for this problem. I've been struggling for a few days now to figure out ways to overcome it.

    Thanks.

    Thursday, September 12, 2013 3:01 AM
  • Hello,

    The following code works for me.

    Add a new blank page called “HelpPage” and add a textbox as follows,

    <Grid>

            <TextBlock x:Name="txtHelp" FontSize="15" TextWrapping="Wrap"></TextBlock>

        </Grid>

    Now add a new method in the code behind of HelpPage as follows,

    public void HelpFlyout()

            {

                string helpText = "Write down your own help menu here";

                txtHelp.Text = helpText;

            }

    Now you have made some changes in your App.xaml file as follows,

    Add an event inside the OnLaunched method as follows,

    SettingsPane.GetForCurrentView().CommandsRequested += App_CommandsRequested;

     

    And inside the event add the following code

    void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)

            {

                var hMenu = new SettingsCommand("help", "Help Menu", (handler) =>

                {

                    var settings = new SettingsFlyout();

                    settings.Content = new HelpPage();

                    settings.HeaderBrush = new SolidColorBrush(_background);

                    settings.Background = new SolidColorBrush(_background);

                    settings.HeaderText = "Help Menu";

                    settings.IsOpen = true;

                });

                args.Request.ApplicationCommands.Add(hMenu);

            }

    Now to set the heading color differently add the background color as follows,

    private Color _background = Color.FromArgb(200, 236, 222, 159);

    So it will come as the image attached.  

    Please let me know if you need some more help on this.

    Thanks

    Saswati


    Saswati Sanyal Blog : http://saswatisanyal.blogspot.com/

    Thursday, September 12, 2013 5:46 AM
  • Hi Saswati,

    Thanks for your reply. The example works great! I have a question though.

    Why there's no need to create a popup and fill the flyout in the popup window instead? The app settings sample that I refer to from MSDN implement a popup and then fill it with the flyout. Additionally, it also determines the height to ensure that the custom flyout fills the screen. Is this necessary when implementing a custom flyout in metro app? Because a number of examples that I refer to uses a popup as well as declaring the height and width in the code-behind.

    I hope you could clarify my doubts.

    Thanks.

    Thursday, September 12, 2013 8:32 AM
  • Hello,

    Thanks for your response. The example that I have shared previously is how to add a link of the help menu under the setting charm. However if you don’t need to add that inside the setting charm then you can have a custom flyout. Please see the guideline for the flyout as follows,

    http://msdn.microsoft.com/en-us/library/windows/apps/hh465341.aspx

    Thanks

    Saswati


    Saswati Sanyal Blog : http://saswatisanyal.blogspot.com/

    Friday, September 13, 2013 4:24 AM