This project is read-only.

customizing settingsflyout

Dec 1, 2014 at 10:51 PM
Thanks for the great work

Im using this framework to build a winrt app, and i reached the need to have a settingsflyout based on style mvvm with the possibility to wire up the model to the view etc

Is it something provided out of the box that i missed somehow or ?

Dec 1, 2014 at 11:04 PM
Hi MouradK,

There actually is some support built in the framework for flyouts. I can't tell you the exact syntax off the top of my head but when I get home this evening I'll do a little research and post an answer

Dec 2, 2014 at 1:37 AM
Ok after doing a little research I remembered that the example app covers how to do a settings flyout.

If you have any specific questions once you look at the example let me know.

Dec 3, 2014 at 12:50 PM
Ok Thanks

I'll have a look at that :)
Dec 3, 2014 at 6:10 PM
You should be able to grab the source and run the example app. It covers the setting charm and a number of other use cases.
Dec 4, 2014 at 10:21 AM
Edited Dec 4, 2014 at 10:21 AM
Hello Again

I managed to get it working !!, thanks for the exampleApp : )

One question remains :
I'm using the settingscharm control as a mainregion to which i will inject different views depending on a context.
I have a need to inject a view to that region + a parameter. I was hoping that calling region.Navigate("viewname", parameter) will do it but
the navigationparameter that i got on the OnNavigateTo method is always null.

I was then trying to use the Context property of the region to pass that parameter but its a readonly property...

Any help on that ?

Dec 4, 2014 at 1:30 PM
Hmmm, I'm a little surprised that the parameter didn't come through. If you can put together a little example app showing what you are doing and I can debug it and figure out what's wrong.

Dec 4, 2014 at 10:59 PM
Edited Dec 4, 2014 at 11:00 PM

Ive attached a sample for repro.

As you will see in the settingcharm control view, i defined a "mainregion2" to which i'm injecting a child view using the region.navigate(viewname, parameter) way
When overriding the onnavigateto on the child view, i see that the parameter is not set.
Dec 5, 2014 at 12:11 AM
Hi mouradk,

I should have some time this weekend to take a look. Hopefully it's something simple that doesn't require a new release.

Dec 5, 2014 at 1:33 PM
Hi Ian

Ok thx : )
Dec 8, 2014 at 3:59 PM
Hi mouradK,

I actually didn't get a chance to look at that this weekend. I'm trying to finish up some other code I've been working on and I got bogged down with that. I'll see if I can get a chance to look this week. December is just always a very busy month.

Dec 17, 2014 at 3:27 AM
Hi mouradk,

Sorry I took so long getting back to you. I've debugged your example and it is a bug. I see where the problem is and the fix is not to hard. I'll see about doing a release at some point in the coming week or two. I have a little bit of a problem in that I need to do the release by hand as the build machine where I was building has since been lost (sadly it has to be built on a windows 8 machine and there aren't any public build systems that can build it).

Mar 6, 2015 at 4:33 PM
Edited Mar 6, 2015 at 4:33 PM
For the benefit of anyone else stumbling across this via Google and sad that this is still not fixed, here is a shim:
using StyleMVVM.Suspension;
using StyleMVVM.View;
using StyleMVVM.ViewModel;

  /// <summary>
  ///   There is an annoying bug in the StyleMVVM framework which prevents the Parameter property
  ///   in StyleNavigationEventArgs from being used to pass parameters for navigation.  Although
  ///   it's been identified for ages ( there 
  ///   has been no development work on the framework for nearly as long...  :-(
  ///   The bug:
  ///     * Calling Region.NavigateTo( [regionname], [parameter] ) dives into the StyleMVVM codebase
  ///       and eventually calls ContentPresenterAdaptor.CallNavigatedTo(...)
  ///     * Here the NavigationParameter property of the viewmodel is set to the parameter value, and
  ///       calls NavigatedTo with an empty StyleNavigationEventArgs :-(
  ///     * This calls StyleMVVM.CSharp.ViewModel.NavigatingViewModel.NavigatedTo(), which then *populates* 
  ///       NavigationParameter *from* the (empty!) StyleNavigationEventArgs, thereby losing the 
  ///       data altogether
  ///   It would be preferable for this to be fixed in the framework, of course, but that seems unlikely,
  ///   so this shim just reimplements the offending method to produce the 'correct' behaviour.
  /// </summary>
  public class FixedRegionAwareViewModel : RegionAwareViewModel,
    /// <summary>
    ///   Fixes NavigatingViewModel.NavigatedTo()
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    void INavigationViewModel.NavigatedTo(object sender, StyleNavigationEventArgs e)
        string tempKey = this.SyncKey;

          SyncService.Instance.ResumeWithContext(this, tempKey);

                         new StyleNavigationEventArgs()
                           Parameter = this.NavigationParameter

Mar 6, 2015 at 5:36 PM
Thanks for posting this. I've been busy with life and other things.

If you would be interested in making a pull request with the fix it would be much appreciated.