public override void OnApplyTemplate() { base.OnApplyTemplate(); var vm = DataContext as AddBookmarksViewModel; var rootDir = new IEntryModel[] { vm.Profile.RootModel }; expFolderPicker.ViewModel.Initializer = new ScriptCommandInitializer() { OnModelCreated = UIScriptCommands.ExplorerDefault(), OnViewAttached = ScriptCommands.Assign("{StartupDir}", vm.CurrentBookmarkDirectory, false, ScriptCommands.Assign("{StartupPath}", "{StartupDir.FullPath}", false, UIScriptCommands.ExplorerGotoStartupPathOrFirstRoot())), RootModels = rootDir, StartupParameters = new ParameterDic() { { "Profiles", vm.Profile }, { "RootDirectories", rootDir }, //{ "StartupPath", vm.CurrentBookmarkDirectory.FullPath }, //{ "StartupPath", _selectedPath }, //{ "FilterString", _filterStr }, { "ViewMode", "List" }, { "ItemSize", 16 }, { "EnableDrag", true }, { "EnableDrop", true }, { "EnableMap", false }, { "FileListNewWindowCommand", NullScriptCommand.Instance }, //Disable NewWindow Command. { "EnableMultiSelect", true }, { "ShowToolbar", false }, { "ShowGridHeader", false } } }; expFolderPicker.ViewModel.FileList.PropertyChanged += (o, e) => { if (e.PropertyName == "CurrentDirectory") { vm.CurrentBookmarkDirectory = expFolderPicker.ViewModel.FileList.CurrentDirectory; } }; vm.PropertyChanged += (o, e) => { if (e.PropertyName == "CurrentBookmarkDirectory") { expFolderPicker.ViewModel.FileList.CurrentDirectory = vm.CurrentBookmarkDirectory; } }; }
public ScriptCommandInitializer() { RootModels = new FileExplorer.Models.IEntryModel[] { }; OnModelCreated = UIScriptCommands.ExplorerDefault(); }