locked
Block Snapped View in Windows 8 Apps

    Question

  • Hi All,

    Am Developing Windows 8 Apps

    My requirement is to block Snapped And Filled View.

    Currently Am Using Following Code in

            private void WindowSizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e)
            {
                if (GlobalVariable.CurrentPage == "Tasks")
                    switch (ApplicationView.Value)
                    {
                        case ApplicationViewState.Filled:
                            //VisualStateManager.GoToState(this, "Filled", false);
                            //this.Frame.Navigate(typeof(BlockView));
                            BlockView();
                            break;
    
                        case ApplicationViewState.FullScreenLandscape:
                            //VisualStateManager.GoToState(this, "FullScreenLandscape", false);
    
                            //this.Frame.Navigate(typeof(CustomerDetails));
                            UnBlockVIew();
                            break;
    
                        case ApplicationViewState.Snapped:
                            //BlockView();
                            //this.Frame.Navigate(typeof(BlockView));
                            BlockView();
                            //VisualStateManager.GoToState(this, "Snapped", false);
                            break;
    
                        case ApplicationViewState.FullScreenPortrait:
                            BlockView();
                            //this.Frame.Navigate(typeof(BlockView));
                            //VisualStateManager.GoToState(this, "FullScreenPortrait", false);
    
                            break;
    
                        default:
                            return;
                    }
            }
    
            private void BlockView()
            {
                LayoutGrid.Visibility = Visibility.Collapsed;
                OrientationGrid.Visibility = Visibility.Visible;
                //TopAppBar.Visibility = Visibility.Collapsed;
                PageHeaderGrid.Visibility = Visibility.Collapsed;
    
            }
    
            private void UnBlockVIew()
            {
                OrientationGrid.Visibility = Visibility.Collapsed;
                //TopAppBar.Visibility = Visibility.Visible;
                LayoutGrid.Visibility = Visibility.Visible;
                PageHeaderGrid.Visibility = Visibility.Visible;
            }

    Am Using Above Code Coz While NAvigating From Page to Page Am Passing Paremeters.

    So I Cannot Use the Below Code.

    void Current_SizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e)
            {
                switch (ApplicationView.Value)
                {
                    case ApplicationViewState.Filled:
                        //VisualStateManager.GoToState(this, "Filled", false);
                        this.Frame.Navigate(typeof(BlockView));
                        break;
    
                    case ApplicationViewState.FullScreenLandscape:
                        //VisualStateManager.GoToState(this, "FullScreenLandscape", false);
                        this.Frame.Navigate(typeof(CallStatus));
                        break;
    
                    case ApplicationViewState.Snapped:
                        this.Frame.Navigate(typeof(BlockView));
                        //VisualStateManager.GoToState(this, "Snapped", false);
                        break;
    
                    case ApplicationViewState.FullScreenPortrait:
                        this.Frame.Navigate(typeof(BlockView));
                        //VisualStateManager.GoToState(this, "FullScreenPortrait", false);
    
                        break;
    
                    default:
                        return;
                }
            }

    As i need to Register Size Changed Event Handler in every page .

    As soon as my Page Size Changed to snapped or filled View "Current_SizeChanged" Is Getting Called From Other Pages As well. 

    How Do i Restrict This Event Getting Called From Other Page As well?

    Any Suggestion Would Be of Great Help

    Thanks


    Arjun

    Tuesday, October 07, 2014 9:21 AM

Answers

  • You can register in the page's OnNavigatedTo and then remove the registration in OnNavigatedFrom.

    --Rob

    • Marked as answer by ArjunShrivatsa Wednesday, October 08, 2014 5:00 AM
    Tuesday, October 07, 2014 7:04 PM
    Owner

All replies

  • You can register in the page's OnNavigatedTo and then remove the registration in OnNavigatedFrom.

    --Rob

    • Marked as answer by ArjunShrivatsa Wednesday, October 08, 2014 5:00 AM
    Tuesday, October 07, 2014 7:04 PM
    Owner
  • Hi Rob,

    Thanks For your Reply,

    I have a Small Doubt.

    How do i hide this Message Box In Snapped View??

    My Application is Navigating to Other Page After This PopUp MSg(saved,Edited);

    Thanks

    Arjun


    Arjun



    Tuesday, October 14, 2014 6:19 AM