diff --git a/src/Files.App.Controls/Sidebar/ISidebarItemModel.cs b/src/Files.App.Controls/Sidebar/ISidebarItemModel.cs
index ab0e4742ae6c..43f08be3f660 100644
--- a/src/Files.App.Controls/Sidebar/ISidebarItemModel.cs
+++ b/src/Files.App.Controls/Sidebar/ISidebarItemModel.cs
@@ -5,6 +5,11 @@ namespace Files.App.Controls
{
public interface ISidebarItemModel : INotifyPropertyChanged
{
+ ///
+ /// The filesystem path represented by this item, if any.
+ ///
+ string? Path { get; }
+
///
/// The children of this item that will be rendered as child elements of the SidebarItem
///
diff --git a/src/Files.App.Controls/Sidebar/SidebarItem.cs b/src/Files.App.Controls/Sidebar/SidebarItem.cs
index ddd0a3df3dc5..9ac319ab1aff 100644
--- a/src/Files.App.Controls/Sidebar/SidebarItem.cs
+++ b/src/Files.App.Controls/Sidebar/SidebarItem.cs
@@ -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()
@@ -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);
diff --git a/src/Files.App/ViewModels/Settings/SettingsPageViewModel.cs b/src/Files.App/ViewModels/Settings/SettingsPageViewModel.cs
index f1bb4c3046d2..479f0e707d2d 100644
--- a/src/Files.App/ViewModels/Settings/SettingsPageViewModel.cs
+++ b/src/Files.App/ViewModels/Settings/SettingsPageViewModel.cs
@@ -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;