mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
fix: branch tree not restore last IsExpanded nodes. See issue #20
* Binding IsExpanded property of TreeViewItem with Models.BranchTreeNode * Current local branch should never be collapsed
This commit is contained in:
parent
ef26f5b41c
commit
213f04a57b
2 changed files with 13 additions and 2 deletions
|
@ -114,7 +114,7 @@ namespace SourceGit.Models {
|
||||||
lastFolder = new BranchTreeNode() {
|
lastFolder = new BranchTreeNode() {
|
||||||
Name = subs[i],
|
Name = subs[i],
|
||||||
Type = BranchTreeNodeType.Folder,
|
Type = BranchTreeNodeType.Folder,
|
||||||
IsExpanded = _expanded.Contains(path),
|
IsExpanded = branch.IsCurrent || _expanded.Contains(path),
|
||||||
};
|
};
|
||||||
roots.Add(lastFolder);
|
roots.Add(lastFolder);
|
||||||
_maps.Add(path, lastFolder);
|
_maps.Add(path, lastFolder);
|
||||||
|
@ -122,7 +122,7 @@ namespace SourceGit.Models {
|
||||||
var folder = new BranchTreeNode() {
|
var folder = new BranchTreeNode() {
|
||||||
Name = subs[i],
|
Name = subs[i],
|
||||||
Type = BranchTreeNodeType.Folder,
|
Type = BranchTreeNodeType.Folder,
|
||||||
IsExpanded = _expanded.Contains(path),
|
IsExpanded = branch.IsCurrent || _expanded.Contains(path),
|
||||||
};
|
};
|
||||||
_maps.Add(path, folder);
|
_maps.Add(path, folder);
|
||||||
lastFolder.Children.Add(folder);
|
lastFolder.Children.Add(folder);
|
||||||
|
|
|
@ -161,6 +161,11 @@
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
LostFocus="OnLocalBranchTreeLostFocus"
|
LostFocus="OnLocalBranchTreeLostFocus"
|
||||||
SelectionChanged="OnLocalBranchTreeSelectionChanged">
|
SelectionChanged="OnLocalBranchTreeSelectionChanged">
|
||||||
|
<TreeView.Styles>
|
||||||
|
<Style Selector="TreeViewItem" x:DataType="m:BranchTreeNode">
|
||||||
|
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
|
||||||
|
</Style>
|
||||||
|
</TreeView.Styles>
|
||||||
<TreeView.ItemTemplate>
|
<TreeView.ItemTemplate>
|
||||||
<TreeDataTemplate ItemsSource="{Binding Children}" x:DataType="{x:Type m:BranchTreeNode}">
|
<TreeDataTemplate ItemsSource="{Binding Children}" x:DataType="{x:Type m:BranchTreeNode}">
|
||||||
<Grid Height="24" ColumnDefinitions="Auto,*,Auto,Auto" Background="Transparent" ContextRequested="OnLocalBranchContextMenuRequested" DoubleTapped="OnDoubleTappedLocalBranchNode">
|
<Grid Height="24" ColumnDefinitions="Auto,*,Auto,Auto" Background="Transparent" ContextRequested="OnLocalBranchContextMenuRequested" DoubleTapped="OnDoubleTappedLocalBranchNode">
|
||||||
|
@ -208,6 +213,12 @@
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
LostFocus="OnRemoteBranchTreeLostFocus"
|
LostFocus="OnRemoteBranchTreeLostFocus"
|
||||||
SelectionChanged="OnRemoteBranchTreeSelectionChanged">
|
SelectionChanged="OnRemoteBranchTreeSelectionChanged">
|
||||||
|
<TreeView.Styles>
|
||||||
|
<Style Selector="TreeViewItem" x:DataType="m:BranchTreeNode">
|
||||||
|
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
|
||||||
|
</Style>
|
||||||
|
</TreeView.Styles>
|
||||||
|
|
||||||
<TreeView.ItemTemplate>
|
<TreeView.ItemTemplate>
|
||||||
<TreeDataTemplate ItemsSource="{Binding Children}" x:DataType="{x:Type m:BranchTreeNode}">
|
<TreeDataTemplate ItemsSource="{Binding Children}" x:DataType="{x:Type m:BranchTreeNode}">
|
||||||
<Grid Height="24" ColumnDefinitions="Auto,*,Auto" Background="Transparent" ContextRequested="OnRemoteBranchContextMenuRequested">
|
<Grid Height="24" ColumnDefinitions="Auto,*,Auto" Background="Transparent" ContextRequested="OnRemoteBranchContextMenuRequested">
|
||||||
|
|
Loading…
Reference in a new issue