RaymenBoshoff
RaymenBoshoff

Reputation: 1

VisualStateManager Open Page in Snapped View

I am developing a windows 8 metro style application using C# and Xaml. I got a syndication news feed grid with syndication items as a datasource. When i click an item i want the view state of the page to be snapped and have the brower control in the filled view state so that my application snapped to 320 width and the website open in a browser control 1024 filled viewstae.

I am using the following code block. The page snapped correctly but the application does not snapped. What can i do to achieve my goal of having a Filled + Snapped combinmation of application snapped and browser control filled.

Here is the code i am using:

    private async void ItemView_ItemClick(object sender, ItemClickEventArgs e)
    {
        FeedItem feedItem = (FeedItem)e.ClickedItem;
        feedItem.Read = true;
        ListView lv = e.OriginalSource as ListView;

        if (lv.SelectedItem != null)
        {
            ListViewItem li = lv.SelectedItem as ListViewItem;
            if (li != null) li.Template = Application.Current.Resources["ReadStandard80ItemTemplate"] as ControlTemplate;
        }

        //this.ApplicationViewStates.
        this.Width = 320;

        this.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Right;
        var CurrentViewState = Windows.UI.ViewManagement.ApplicationView.Value;

        this.MainFramne.Width = 320;

        VisualStateManager.GoToState(this.MainFramne, "Snapped", false);
        Snapped.Storyboard.Begin();


        await Windows.System.Launcher.LaunchUriAsync(new Uri(feedItem.Link.ToString()));
        var test = Windows.UI.ViewManagement.ApplicationView.Value;

    }

Upvotes: 0

Views: 757

Answers (1)

Andy Rich
Andy Rich

Reputation: 1962

You are not able to change the snapped/filled/maximized state of any Windows Store Application programmatically. It can only be done in response to a user-initiated request. (This is done to prevent applications from spoofing or otherwise behaving maliciously.)

You might want to consider instead hosting a browser instance (WebView) within your application if it is in maximized view, and if you're in snapped view already then you launch to the external browser (which should hopefully come up filled).

Upvotes: 1

Related Questions