New to Telerik UI for WinForms? Start a free 30-day trial

Base class for the different file dialogs.

Definition

Namespace:Telerik.WinControls.FileDialogs

Assembly:Telerik.WinControls.UI.dll

Syntax:

C#
public abstract class DialogViewModel : ViewModelBase, INotifyPropertyChanged, IDisposable, IDialogViewModel, ICurrentDirectoryViewModel, INotifyPropertyChanging

Inheritance: objectViewModelBaseDialogViewModel

Derived Classes: FileDialogViewModelOpenFolderDialogViewModel

Implements: ICurrentDirectoryViewModelIDialogViewModelIDisposableINotifyPropertyChangedINotifyPropertyChanging

Inherited Members ViewModelBase.Dispose()ViewModelBase.InvokeOnUIThread(Action)ViewModelBase.OnPropertyChanged(string)ViewModelBase.VerifyPropertyName(string)ViewModelBase.PropertyChanged

Constructors

Initializes a new instance of the DialogViewModel class.

C#
protected DialogViewModel(FileSystemInfoWrapperFactoryBase fileSystemInfoWrapperFactory, bool showNetwork, string rootDirPath = "")
Parameters:fileSystemInfoWrapperFactoryFileSystemInfoWrapperFactoryBase

The FileSystemInfoWrapperFactoryBase used for creating FileSystemInfoWrappers.

showNetworkbool

Boolean indicating whether network locations are shown.

rootDirPathstring

The path of the initial directory.

Properties

Gets the currently visible FileSystemInfoWrappers.

C#
public BindingList<FileSystemInfoWrapper> CurrentFileSystemObjects { get; }

Gets the currently drilled directory.

C#
public DirectoryBaseWrapper CurrentParentDirectory { get; set; }

Implements: ICurrentDirectoryViewModel.CurrentParentDirectory

Collection of search results. We do not use ViewModels CurrentFileSystemObjects in order to be process the results in background successfully.

C#
public BindingList<FileSystemInfoWrapper> CurrentSearchResults { get; }

Gets or sets the collection of custom places.

C#
public IEnumerable<DirectoryInfoWrapper> CustomPlaces { get; set; }

Implements: IDialogViewModel.CustomPlaces

Determines how the files and folders in the DialogViewModel can be edited. Note that the shell context menu and drag and drop operations are handled separately.

C#
public EditingOptions EditingOptions { get; set; }

Gets the FileSystemInfoWrapperFactoryBase for creating wrappers for FileSystemInfos.

C#
protected FileSystemInfoWrapperFactoryBase FileSystemInfoWrapperFactory { get; }

Gets or sets the initial directory.

C#
public DirectoryBaseWrapper InitialDirectory { get; set; }

Implements: IDialogViewModel.InitialDirectory

Gets or sets the ExplorerControl used by FileDialogs helpers for theme-aware layout and directory-change notifications.

C#
public static ExplorerControl InvokeContext { get; set; }

Return true if the selected item is directory.

C#
public bool IsDirectorySelected { get; }

Used to trigger a busy indicator while network location is being loaded for the main pane.

C#
public bool IsMainPaneLoadingNetwork { get; set; }

Gets or sets the IsSearchViewActive. When true, it indicates the Dialog's Main Pane shows results from search operation.

C#
public bool IsSearchViewActive { get; set; }

Gets the available layouts for the dialog explorer.

C#
public virtual IEnumerable<LayoutConfigurationModel> Layouts { get; }

Implements: IDialogViewModel.Layouts

Gets the root directory wrapper currently used for folder navigation.

C#
public DirectoryBaseWrapper MainNavigationRoot { get; }

Gets the collection of root locations available in the dialog's navigation pane.

C#
public ObservableCollection<DirectoryBaseWrapper> MainNavigationRootSource { get; }

Gets or sets a string representing the full path to the current file system object.

C#
public string Name { get; set; }

Implements: IDialogViewModel.Name

Gets a string representing the path to the current folder.

C#
public string Path { get; }

Implements: IDialogViewModel.Path

Gets the currently root and current visible FileSystemInfoWrappers.

C#
public BindingList<FileSystemInfoWrapper> RootAndCurrentFileSystemObjects { get; }

Gets or sets the handler called when the dialog accepts the selected file-system objects.

C#
public IInvokeSelectedFileSystemObjects SelectedFilesInvoker { get; set; }

Gets the currently selected file or folder.

C#
public FileSystemInfoWrapper SelectedFileSystemObject { get; set; }

Implements: ICurrentDirectoryViewModel.SelectedFileSystemObject

Gets the selected LayoutConfigurationModel.

C#
public LayoutConfigurationModel SelectedLayout { get; set; }

Implements: IDialogViewModel.SelectedLayout

Gets or sets a boolean value indicating whether the dialog shows hidden files and folders.

C#
public bool ShowHiddenFiles { get; set; }

Implements: IDialogViewModel.ShowHiddenFiles

Methods

Determines whether Copy is enabled by EditingOptions and the current selection supports shell commands.

C#
protected virtual bool CanCopyExecute()
Returns:

bool

Determines whether Cut is enabled by EditingOptions and the current selection supports shell commands.

C#
protected virtual bool CanCutExecute()
Returns:

bool

Determines whether Delete is enabled by EditingOptions and the current selection supports shell commands.

C#
protected virtual bool CanDeleteExecute()
Returns:

bool

Determines whether the selected file-system object can be edited.

C#
protected virtual bool CanEditExecute()
Returns:

bool

Defines the method that determines whether the accept command can execute in its current state.

C#
protected virtual bool CanExecuteAccept()
Returns:

bool

Determines whether a selected item exists and is not a non-operable network or shell directory.

C#
protected virtual bool CanExecuteHelper()
Returns:

bool

Determines whether a child folder can be created in the current directory under the configured editing options.

C#
protected virtual bool CanNewFolderExecute()
Returns:

bool

Determines whether Paste is enabled by EditingOptions.

C#
protected virtual bool CanPasteExecute()
Returns:

bool

Creates new child folder in the CurrentParentDirectory.

C#
public bool CreateNewChildFolder()
Returns:

bool

true if the new folder and its wrapper are created; otherwise, false.

Implements: ICurrentDirectoryViewModel.CreateNewChildFolder()

Clears the shared ExplorerControl context during disposal.

C#
protected override void Dispose(bool disposing)
Parameters:disposingbool

Indicates whether disposal is occurring as part of an explicit dispose operation.

Overrides: ViewModelBase.Dispose(bool)

Gets the current visible FileSystemInfoWrappers.

C#
protected abstract IEnumerable<FileSystemInfoWrapper> GetCurrentFileSystemInfoWrappers(DirectoryBaseWrapper parent)
Parameters:parentDirectoryBaseWrapper

The directory whose visible file-system entries are retrieved.

Returns:

IEnumerable<FileSystemInfoWrapper>

Execute logic when accept is executed for the selected FileSystemInfoWrappers.

C#
protected virtual void InvokeSelectedFileSystemObjects()

Runs the Shell Copy command for the current selection.

C#
protected virtual void OnCopyCommand(IntPtr controlHandle)
Parameters:controlHandleIntPtr

Handle of the control that owns the shell operation.

Notifies bindings that the current search results were replaced or cleared.

C#
public void OnCurrentSearchResultsChanged()

Marks the current selection as cut and runs the Shell Cut command.

C#
protected virtual void OnCutCommand(IntPtr controlHandle)
Parameters:controlHandleIntPtr

Handle of the control that owns the shell operation.

Runs the Shell Delete command for the current selection.

C#
protected virtual void OnDeleteCommand(IntPtr controlHandle)
Parameters:controlHandleIntPtr

Handle of the control that owns the shell operation.

Enters edit mode for the selected file-system object.

C#
protected virtual void OnEditExecuted()

Creates a child folder when this view model supports current-directory operations.

C#
protected virtual void OnNewFolderExecuted()

Runs the Shell Paste command for the current directory.

C#
protected virtual void OnPasteCommand(IntPtr controlHandle)
Parameters:controlHandleIntPtr

Handle of the control that owns the shell operation.

Raises PropertyChanging for the specified property.

C#
protected virtual void OnPropertyChanging(string propertyName)
Parameters:propertyNamestring

The name of the property about to change.

Notifies when the SelectedFileSystemObject changes.

C#
protected virtual void OnSelectionChanged()

Builds the target selection and invokes the specified Shell command.

C#
protected virtual void PrepareCommandAndExecute(IntPtr controlHandle, ShellContextMenuCommand command)
Parameters:controlHandleIntPtr

Handle of the control that owns the shell operation.

commandShellContextMenuCommand

The Shell command to execute.

Resets the selection.

C#
protected virtual void ResetSelection()

Raises DirectoryNavigating and reports whether navigation to the specified directory was canceled.

C#
protected virtual bool ShouldCancelDiretoryNavigating(string newDir)
Parameters:newDirstring

The path of the directory being navigated to.

Returns:

bool

true if a handler canceled navigation; otherwise, false.

Events

Occurs before navigation to a directory; set Cancel to prevent the navigation.

C#
public event EventHandler<DirectoryNavigatingEventArgs> DirectoryNavigating

Occurs when the view model raises its pre-change notification; the base implementation does so before CurrentParentDirectory changes.

C#
public event PropertyChangingEventHandler PropertyChanging

Implements: INotifyPropertyChanging.PropertyChanging