@@ -1141,6 +1141,7 @@ public async Task LoadExtendedItemPropertiesAsync(ListedItem item)
11411141 var fileFRN = await FileTagsHelper . GetFileFRN ( matchingStorageFile ) ;
11421142 var fileTag = FileTagsHelper . ReadFileTag ( item . ItemPath ) ;
11431143 var itemType = ( item . ItemType == "Folder" . GetLocalizedResource ( ) ) ? item . ItemType : matchingStorageFile . DisplayType ;
1144+ var contextualProperty = await GetContextualPropertyString ( matchingStorageFile , item ) ;
11441145
11451146 cts . Token . ThrowIfCancellationRequested ( ) ;
11461147
@@ -1152,6 +1153,7 @@ await dispatcherQueue.EnqueueOrInvokeAsync(() =>
11521153 item . FileFRN = fileFRN ;
11531154 item . FileTags = fileTag ;
11541155 item . IsElevationRequired = CheckElevationRights ( item ) ;
1156+ item . ContextualProperty = contextualProperty ;
11551157 } ,
11561158 Microsoft . UI . Dispatching . DispatcherQueuePriority . Low ) ;
11571159
@@ -1187,6 +1189,8 @@ await dispatcherQueue.EnqueueOrInvokeAsync(() =>
11871189 var fileFRN = await FileTagsHelper . GetFileFRN ( matchingStorageFolder ) ;
11881190 var fileTag = FileTagsHelper . ReadFileTag ( item . ItemPath ) ;
11891191 var itemType = ( item . ItemType == "Folder" . GetLocalizedResource ( ) ) ? item . ItemType : matchingStorageFolder . DisplayType ;
1192+ var contextualProperty = await GetContextualPropertyString ( matchingStorageFile , item ) ;
1193+
11901194 cts . Token . ThrowIfCancellationRequested ( ) ;
11911195
11921196 await dispatcherQueue . EnqueueOrInvokeAsync ( ( ) =>
@@ -1196,6 +1200,7 @@ await dispatcherQueue.EnqueueOrInvokeAsync(() =>
11961200 item . SyncStatusUI = CloudDriveSyncStatusUI . FromCloudDriveSyncStatus ( syncStatus ) ;
11971201 item . FileFRN = fileFRN ;
11981202 item . FileTags = fileTag ;
1203+ item . ContextualProperty = contextualProperty ;
11991204 } ,
12001205 Microsoft . UI . Dispatching . DispatcherQueuePriority . Low ) ;
12011206
@@ -1908,6 +1913,43 @@ public async Task<CloudDriveSyncStatus> CheckCloudDriveSyncStatusAsync(IStorageI
19081913 return ( CloudDriveSyncStatus ) syncStatus ;
19091914 }
19101915
1916+ private async Task < string > GetContextualPropertyString ( IStorageItem matchingStorageItem , ListedItem listedItem )
1917+ {
1918+ var contextualProperty = string . Empty ;
1919+
1920+ if ( matchingStorageItem is BaseStorageFile file && file . Properties != null )
1921+ {
1922+ if ( FileExtensionHelpers . IsImageFile ( listedItem . FileExtension ) )
1923+ {
1924+ var properties = await FilesystemTasks . Wrap ( ( ) => file . Properties . RetrievePropertiesAsync ( [ "System.Image.Dimensions" ] ) . AsTask ( ) ) ;
1925+ var value = properties . Result [ "System.Image.Dimensions" ] ? . ToString ( ) ;
1926+
1927+ if ( ! string . IsNullOrEmpty ( value ) )
1928+ contextualProperty = $ "{ Strings . PropertyDimensions . GetLocalizedResource ( ) } : { value } ";
1929+ }
1930+ else if ( FileExtensionHelpers . IsAudioFile ( listedItem . FileExtension ) || FileExtensionHelpers . IsVideoFile ( listedItem . FileExtension ) )
1931+ {
1932+ var properties = await FilesystemTasks . Wrap ( ( ) => file . Properties . RetrievePropertiesAsync ( [ "System.Media.Duration" ] ) . AsTask ( ) ) ;
1933+ var value = TimeSpan . FromTicks ( ( long ) ( ulong ) properties . Result [ "System.Media.Duration" ] ) . ToString ( @"hh\:mm\:ss" ) ;
1934+
1935+ if ( ! string . IsNullOrEmpty ( value ) )
1936+ contextualProperty = $ "{ Strings . PropertyDuration . GetLocalizedResource ( ) } : { value } ";
1937+ }
1938+ else if ( FileExtensionHelpers . IsExecutableFile ( listedItem . FileExtension , true ) )
1939+ {
1940+ var properties = await FilesystemTasks . Wrap ( ( ) => file . Properties . RetrievePropertiesAsync ( [ "System.FileVersion" ] ) . AsTask ( ) ) ;
1941+ var value = properties . Result [ "System.FileVersion" ] ? . ToString ( ) ;
1942+
1943+ if ( ! string . IsNullOrEmpty ( value ) )
1944+ contextualProperty = $ "{ Strings . PropertyVersion . GetLocalizedResource ( ) } : { value } ";
1945+ }
1946+ }
1947+
1948+ return ! string . IsNullOrEmpty ( contextualProperty )
1949+ ? contextualProperty
1950+ : $ "{ Strings . Modified . GetLocalizedResource ( ) } : { listedItem . ItemDateModified } ";
1951+ }
1952+
19111953 private async Task WatchForStorageFolderChangesAsync ( BaseStorageFolder ? rootFolder )
19121954 {
19131955 if ( rootFolder is null )
0 commit comments