Skip to content

Commit

Permalink
fixed selected cells content gethering issue
Browse files Browse the repository at this point in the history
  • Loading branch information
w-ahmad committed Aug 14, 2024
1 parent 6a077b9 commit 0994bc2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/SampleApp/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<table:TableView x:Name="tableView"
Grid.Row="1"
Margin="16"
SelectionMode="Extended">
ShowExportOptions="True">
<table:TableView.Columns>
<table:TableViewTextColumn Header="Rank"
Binding="{Binding Rank}" />
Expand Down
6 changes: 2 additions & 4 deletions src/WinUI.TableView/TableView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,6 @@ private string GetCellsContent(IEnumerable<TableViewCellSlot> slots, bool includ
return string.Empty;
}

var minRow = slots.Select(x => x.Row).Min();
var maxRow = slots.Select(x => x.Row).Max();
var minColumn = slots.Select(x => x.Column).Min();
var maxColumn = slots.Select(x => x.Column).Max();

Expand All @@ -328,7 +326,7 @@ private string GetCellsContent(IEnumerable<TableViewCellSlot> slots, bool includ
stringBuilder.AppendLine(GetHeadersContent(separator, minColumn, maxColumn));
}

for (var row = minRow; row <= maxRow; row++)
foreach(var row in slots.Select(x => x.Row).Distinct())
{
var item = Items[row];
var type = ItemsSource?.GetType() is { } listType && listType.IsGenericType ? listType.GetGenericArguments()[0] : item?.GetType();
Expand All @@ -338,7 +336,7 @@ private string GetCellsContent(IEnumerable<TableViewCellSlot> slots, bool includ
if (Columns.VisibleColumns[col] is not TableViewBoundColumn column ||
!slots.Contains(new TableViewCellSlot(row, col)))
{
stringBuilder.Append('\t');
stringBuilder.Append(separator);
continue;
}

Expand Down

0 comments on commit 0994bc2

Please sign in to comment.