mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-03 01:55:00 +00:00
feature: new way to expand/collapse folder node in TreeDataGrid
This commit is contained in:
parent
f4d379e3b8
commit
55c9fae110
10 changed files with 58 additions and 73 deletions
|
@ -188,7 +188,12 @@ namespace SourceGit.Models
|
|||
}
|
||||
else if (e.ClickCount % 2 == 0)
|
||||
{
|
||||
_rowDoubleTapped?.Invoke(this, e);
|
||||
var focus = _source.Rows[row.RowIndex];
|
||||
if (focus is IExpander expander && HasChildren(focus))
|
||||
expander.IsExpanded = !expander.IsExpanded;
|
||||
else
|
||||
_rowDoubleTapped?.Invoke(this, e);
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
else if (sender.RowSelection.Count > 1)
|
||||
|
@ -420,7 +425,22 @@ namespace SourceGit.Models
|
|||
|
||||
protected override IEnumerable<TModel> GetChildren(TModel node)
|
||||
{
|
||||
if (node == null)
|
||||
return null;
|
||||
|
||||
return _childrenGetter?.Invoke(node);
|
||||
}
|
||||
|
||||
private bool HasChildren(IRow row)
|
||||
{
|
||||
var children = GetChildren(row.Model as TModel);
|
||||
if (children != null)
|
||||
{
|
||||
foreach (var c in children)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue