public VVM LoadViewViewModel <VM> (string xamlResource) where VM : ViewModelBase, new() { VVM ret = new VVM(); ret.ViewModel = new VM(); ret.View = LoadXaml(xamlResource) as FrameworkElement; if (ret.View != null) { ret.View.DataContext = ret.ViewModel; if (ret.ViewModel is IDispatcherObject) { ((IDispatcherObject)ret.ViewModel).Dispatcher = ret.View.Dispatcher; } } return(ret); }
public HomeViewModel() { TestCommand = new DelegateCommand( ToggleTestCommand, CanTestCommand ); toolbar = ViewMappings.Resolver.LoadViewViewModel<ToolbarViewModel>("/Views;component/Views/Toolbar.xaml"); ProgressValue = 0.0; }