Friday, July 30, 2010

Outlook 2010/IMAP/Google Apps

With Outlook 2010 over IMAP to Google Apps/Gmail, the default setting is that when you delete an item, it is moved into ‘Trash’ instead of archived. This is a problem if you count on having those Archived items out there for future reference. (Trash is discarded after 30 days).

To change this:

  • Click on File/Account Settings
  • Doubleclick the e-mail account you want to change.
  • Click More Settings
  • Go to the Delete Items Tab
  • Select '”Move deleted items to the following folder”
  • Select the “All Mail” folder in the Tree View. image
  • Click OK
  • Click Next and let it finish the setup.

That should do it. Now all deleted items will be Archived.

Thursday, July 8, 2010

Restoring a Windows State When Navigating Back to a Page

When navigating to another page and back again using the Silverlight Navigation Framework, sometimes it is useful to return to the page and see it exactly as it was.  Fortunately, this is easy to do if you are using an MVVM framework. 

When navigating away from the page, save the ViewModel in the App.Current.Resources collection.


protected override void OnNavigatedFrom(NavigationEventArgs e)
{
if (App.Current.Resources["theViewModel"] != null)
App.Current.Resources.Remove("theViewModel");
App.Current.Resources.Add("theViewModel", this.DataContext);
base.OnNavigatedFrom(e);
}

When returning to the page, pull it back out again and assign it to the page.


         protected override void OnNavigatedTo(NavigationEventArgs e)  
{
if (App.Current.Resources["theViewModel"] != null)
this.DataContext = App.Current.Resources["theViewModel"];
}