diff --git a/src/SampleApp/MainWindow.xaml b/src/SampleApp/MainWindow.xaml index 7752021..dbecf3e 100644 --- a/src/SampleApp/MainWindow.xaml +++ b/src/SampleApp/MainWindow.xaml @@ -30,7 +30,7 @@ + ShowExportOptions="True"> diff --git a/src/WinUI.TableView/TableView.cs b/src/WinUI.TableView/TableView.cs index 9994579..8382757 100644 --- a/src/WinUI.TableView/TableView.cs +++ b/src/WinUI.TableView/TableView.cs @@ -315,8 +315,6 @@ private string GetCellsContent(IEnumerable 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(); @@ -328,7 +326,7 @@ private string GetCellsContent(IEnumerable 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(); @@ -338,7 +336,7 @@ private string GetCellsContent(IEnumerable slots, bool includ if (Columns.VisibleColumns[col] is not TableViewBoundColumn column || !slots.Contains(new TableViewCellSlot(row, col))) { - stringBuilder.Append('\t'); + stringBuilder.Append(separator); continue; }