Reputation: 1
In Windows 10, I used StorageProviderSyncRootInfo
to create a sync directory and successfully added custom properties. I want Windows File Explorer to display these custom property columns by default.
Add custom property:
public static void RegisterCustomStates(StorageProviderSyncRootInfo syncRootInfo)
{
var definitions = syncRootInfo.StorageProviderItemPropertyDefinitions;
foreach (var state in CustomState.Values)
{
var def = new StorageProviderItemPropertyDefinition
{
DisplayNameResource = state.Name,
Id = state.Id
};
if (!definitions.Contains(def))
definitions.Add(def);
}
}
public class CustomState
{
public static readonly CustomState SyncStatus = new(1, "Status", "shell32.dll,-259");
public static readonly CustomState CheckOutFlag = new(2, "CheckOut", "shell32.dll,-259");
public static IEnumerable<CustomState> Values
{
get
{
yield return SyncStatus;
yield return CheckOutFlag;
}
}
#region definitions
public int Id { get; }
public string Name { get; }
public string IconResource { get; }
private CustomState(int id, string name, string iconResource)
{
Id = id;
Name = name;
IconResource = iconResource;
}
#endregion
}
Expected result
I expect two fields to be displayed as columns in Windows Explorer by default:
Current actual result
The current situation requires users to manually select them through the "More" option.
Upvotes: 0
Views: 41