Nick's .NET Travels

Continually looking for the yellow brick road so I can catch me a wizard....

Refactoring StateManager to StateManager Binding

In my previous post, BuildIt.States from a ViewModel, I showed a rather messy way to connect on StateManager to another. I’m just in the process of refactoring BuildIt.States to include an extra method on the IStateManager interface to enable simple binding between two StateManagers, and their respective StateGroups. This would significantly simplify the code necessary, as well as ensuring all StateGroups within the two StateManagers are synchronized.

private IStateBinder Binder { get; set; }
protected override void OnNavigatedTo(NavigationEventArgs e)

    Binder = manager.Bind(ViewModel.StateManager);
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)

    Binder = null;
I’ll be updating the BuildIt.States NuGet package in the coming days to include this additional method.

Comments are closed