Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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 => null;
Comment thread
0x5bfa marked this conversation as resolved.
Outdated

/// <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
Loading