Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
NEW FEATURE: Navigation Containers now support View-specific Navigation State
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Rishi Oberoi  
View profile  
 More options Jan 24 2011, 11:53 pm
From: Rishi Oberoi <orkta...@gmail.com>
Date: Mon, 24 Jan 2011 20:53:17 -0800 (PST)
Local: Mon, Jan 24 2011 11:53 pm
Subject: NEW FEATURE: Navigation Containers now support View-specific Navigation State

One of the things you see in highly polished navigation-driven applications
(like in WP7) is that they hold the visual state as you navigate back and
forward. Now, one way of doing that is to hold the entire previous/next
visuals in memory or the other (better/intelligent) way is to cache only
the relevant visual cues and store/restore them as you navigate. The later
approach is now supported in nRoute, with the addition of
the ISupportNavigationViewState contract. This new contract actually looks
quite similar to what you might be used to:

    public interface ISupportNavigationViewState
    {
        void RestoreState(ParametersCollection state);

        ParametersCollection SaveState();
    }

Yes, for those in the know, it reads exactly the same as the
ISupportNavigationState interface; however this is specifically meant to
cache the visuals related state as opposed to the logical state. The idea is
that you'll implement this off the View, and store things like the
scroll-position or selected index and restore them when
back/forward/return-navigated upon, consider:

        public void RestoreState(ParametersCollection state)
        {
            this.SearchTextbox.Text = state.GetValueOrDefault("SEARCH", this.SearchTextbox.Text);

            var _offset = default(double);
            if (state.TryGetValue("VOFFSET", out _offset))
            {
                ScrollView.Loaded += (s, e) => ScrollView.ScrollToVerticalOffset(_offset);
            }
        }

        public ParametersCollection SaveState()
        {
            return new ParametersCollection()
            {
                new Parameter("SEARCH", SearchTextbox.Text),
                new Parameter("VOFFSET", ScrollView.VerticalOffset)
            };
        }

And so now all the ISupportNavigationViewState supporting navigation
containers keep two separate states - one for the logical state (normally
from the VM) and one for the visual state (normally from the View). I think
this will allow us to create more engaging and visually consistent
user-experiences - or so I think :)

Cheers,
Rishi

PS: Note the GetValueOrDefault and TryGetValue methods off the state
parameter, they are two of the newly added extension methods which hopefully
will make it easier to get around the non-strongly typed nature of the
ParametersCollection type.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »