diff --git a/src/ClaudeDo.Ui/ViewModels/Modals/WorktreeModalViewModel.cs b/src/ClaudeDo.Ui/ViewModels/Modals/WorktreeModalViewModel.cs index 26661c5..3d880ad 100644 --- a/src/ClaudeDo.Ui/ViewModels/Modals/WorktreeModalViewModel.cs +++ b/src/ClaudeDo.Ui/ViewModels/Modals/WorktreeModalViewModel.cs @@ -20,6 +20,7 @@ public sealed partial class WorktreeNodeViewModel : ViewModelBase public bool IsDirectory { get; init; } public string RelativePath { get; init; } = ""; public ObservableCollection Children { get; } = new(); + [ObservableProperty] private bool _isExpanded = true; } public sealed partial class WorktreeModalViewModel : ViewModelBase diff --git a/src/ClaudeDo.Ui/Views/Modals/WorktreeModalView.axaml b/src/ClaudeDo.Ui/Views/Modals/WorktreeModalView.axaml index c380a8d..d43d6cd 100644 --- a/src/ClaudeDo.Ui/Views/Modals/WorktreeModalView.axaml +++ b/src/ClaudeDo.Ui/Views/Modals/WorktreeModalView.axaml @@ -56,6 +56,11 @@ SelectedItem="{Binding SelectedNode, Mode=TwoWay}" Background="Transparent" Margin="8,0,4,8"> + + + diff --git a/src/ClaudeDo.Ui/Views/Modals/WorktreeModalView.axaml.cs b/src/ClaudeDo.Ui/Views/Modals/WorktreeModalView.axaml.cs index 37895ed..36f1f63 100644 --- a/src/ClaudeDo.Ui/Views/Modals/WorktreeModalView.axaml.cs +++ b/src/ClaudeDo.Ui/Views/Modals/WorktreeModalView.axaml.cs @@ -62,9 +62,8 @@ public partial class WorktreeModalView : Window if (sender is not Control c) return; if (c.DataContext is not WorktreeNodeViewModel node) return; if (!node.IsDirectory) return; - var tvi = c.FindAncestorOfType(); - if (tvi is null) return; - tvi.IsExpanded = !tvi.IsExpanded; + node.IsExpanded = !node.IsExpanded; + e.Handled = true; } private void OnTitleBarPressed(object? sender, PointerPressedEventArgs e)