Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Files.App.Controls/Sidebar/ISidebarItemModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ namespace Files.App.Controls
{
public interface ISidebarItemModel : INotifyPropertyChanged
{
/// <summary>
/// The filesystem path represented by this item, if any.
/// </summary>
string? Path { get; }

/// <summary>
/// The children of this item that will be rendered as child elements of the SidebarItem
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App.Controls/Sidebar/SidebarItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void HandleItemChange()
HookupItemChangeListener(null, Item);
UpdateExpansionState();
ReevaluateSelection();
CanDrag = Item?.GetType().GetProperty("Path")?.GetValue(Item) is string path && Path.IsPathRooted(path);
CanDrag = Item?.Path is string path && Path.IsPathRooted(path);
}

private void HookupOwners()
Expand Down Expand Up @@ -140,7 +140,7 @@ private void HookupItemChangeListener(ISidebarItemModel? oldItem, ISidebarItemMo

private void SidebarItem_DragStarting(UIElement sender, DragStartingEventArgs args)
{
if (Item?.GetType().GetProperty("Path")?.GetValue(Item) is not string dragPath || !Path.IsPathRooted(dragPath))
if (Item?.Path is not string dragPath || !Path.IsPathRooted(dragPath))
return;

args.Data.SetData(StandardDataFormats.Text, dragPath);
Expand Down
1 change: 1 addition & 0 deletions src/Files.App/ViewModels/Settings/SettingsPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public sealed partial class SettingsNavigationItem : ObservableObject, ISidebarI
public string AutomationId { get; }
public string Text { get; }
public ThemedIcon IconElement { get; }
public string? Path => null;

// ISidebarItemModel
public object? Children => null;
Expand Down
Loading