Skip to content

Commit

Permalink
Keep treeview expand after open new tab (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzqqqzzz authored May 2, 2022
1 parent d097e74 commit 0781626
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions AOEMods.Essence.Editor/ArchiveItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public string RenamingName

private string renamingName = "";

public bool IsExpanded { get; set; }

public ObservableCollection<ArchiveItemViewModel>? Children
{
get => children;
Expand Down
3 changes: 3 additions & 0 deletions AOEMods.Essence.Editor/ArchiveView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling">
<TreeView.Resources>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
</Style>
<HierarchicalDataTemplate DataType="{x:Type local:ArchiveItemViewModel}" ItemsSource="{Binding Children}">
<Grid>
<Label Padding="0" Visibility="{Binding Renaming, Converter={StaticResource NotBoolToVis}}"
Expand Down

0 comments on commit 0781626

Please sign in to comment.