Entry Types

Entries are the items to be displayed in the UI. In Model-View-ViewModel, they are the model. They are encapsulated inside an EntryViewModel, but it's the Entry that's defined by the component user.


In v1, entry is DirectoryInfo, and is unchangable except do a solution wide replace.


In v2, the entry is typed (EntryModel<FI, DI, FSI>), where FI, DI, FSI means FileInfo, DirectoryInfo and FileSystemInfo, while you can supply your own model, for examples my FileInfoEx, DirectoryInfoEx and FileSystemInfoEx.

This allow use of different model types, also making it generic allow it to access the EntryModel without typing. I later found this is a bad idea because this makes the ViewModel support one type of entity.


So in v3, IEntryModel is no longer typed, there are several properties that must be implemented (Label, FullName etc), but user can define their own IEntryModel, and on the other side, define the columns using bindings.

explorerModel.FileList.Columns.ColumnList = new ColumnInfo[] 
        ColumnInfo.FromTemplate("Name", "GridLabelTemplate", "EntryModel.Label", new               
            ValueComparer<IEntryModel>(p => p.Label), 200),   
        ColumnInfo.FromBindings("FSI.Attributes", "EntryModel.Attributes", "", 
            new ValueComparer<IEntryModel>(p => 
                (p is FileSystemInfoModel) ? (p as FileSystemInfoModel).Attributes
                : System.IO.FileAttributes.Normal), 200)   

Last edited May 24, 2014 at 9:47 AM by lycj, version 3


No comments yet.