Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions src/ui/Features/Main/Layout/InitLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,14 @@ private static void CleanupControl(Control? control)
dataGrid.Columns.Clear();
dataGrid.ContextFlyout = null;
}
// Handle TableView (the main subtitle grid) - clear data bindings and sources
else if (control is TableView tableView)
{
tableView.ItemsSource = null;
tableView.SelectedItem = null;
tableView.Columns.Clear();
tableView.ContextFlyout = null;
}
// Handle TextBox - clear event handlers
else if (control is TextBox textBox)
{
Expand Down
262 changes: 129 additions & 133 deletions src/ui/Features/Main/Layout/InitListViewAndEditBox.cs

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/ui/Features/Main/MainHelpers/RightToLeftHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private static void MirrorTextEditGrid(Grid grid, FlowDirection flowDirection)
/// the items source re-creates the rows; selection and scroll position are
/// restored.
/// </summary>
internal static void RefreshDataGridBindings(DataGrid? grid, System.Collections.IEnumerable? itemsSource, object? selected)
internal static void RefreshDataGridBindings(TableView? grid, System.Collections.IEnumerable? itemsSource, object? selected)
{
if (grid == null)
{
Expand All @@ -112,7 +112,7 @@ internal static void RefreshDataGridBindings(DataGrid? grid, System.Collections.
if (selected != null)
{
grid.SelectedItem = selected;
grid.ScrollIntoView(selected, null);
grid.ScrollIntoView(selected);
}
}

Expand Down Expand Up @@ -142,6 +142,10 @@ private static void SetFlowDirectionRecursive(Visual visual, FlowDirection flowD
{
dataGrid.FlowDirection = flowDirection;
}
else if (visual is TableView tableView)
{
tableView.FlowDirection = flowDirection;
}
else if (visual is Grid grid && grid.Name == "SubtitleTextEditGrid")
{
MirrorTextEditGrid(grid, flowDirection);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Features/Main/MainView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ protected override object Build()

_vm.ContentGrid.InvalidateMeasure();
_vm.ContentGrid.InvalidateArrange();
Dispatcher.UIThread.Post(() => _vm.SubtitleGrid.Focus());
Dispatcher.UIThread.Post(() => TableViewExtras.FocusRow(_vm.SubtitleGrid));
}, DispatcherPriority.Loaded);
};

Expand Down
835 changes: 209 additions & 626 deletions src/ui/Features/Main/MainViewModel.cs

Large diffs are not rendered by default.

Loading