Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/xwt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVsevolod Kukol <sevoku@microsoft.com>2018-03-20 19:02:02 +0300
committerVsevolod Kukol <sevoku@microsoft.com>2018-03-20 19:02:02 +0300
commit13eab08f9f87ab524a4329262ba5e1d61c2c751e (patch)
tree4b740d95bd7031aad782f39b40c634f7d381c632
parentef3a7ab5dea71938094db025c84c5f2a1c89705c (diff)
[Mac] Improve List initializationmac-improve-cell-size-calculation
-rw-r--r--Xwt.XamMac/Xwt.Mac/ListViewBackend.cs12
1 files changed, 8 insertions, 4 deletions
diff --git a/Xwt.XamMac/Xwt.Mac/ListViewBackend.cs b/Xwt.XamMac/Xwt.Mac/ListViewBackend.cs
index 2b6d11a8..74c1fb40 100644
--- a/Xwt.XamMac/Xwt.Mac/ListViewBackend.cs
+++ b/Xwt.XamMac/Xwt.Mac/ListViewBackend.cs
@@ -156,9 +156,13 @@ namespace Xwt.Mac
public override NSTableColumn AddColumn (ListViewColumn col)
{
NSTableColumn tcol = base.AddColumn (col);
- var widths = new List<nfloat> ();
- if (Table.RowCount > 0)
- widths.InsertRange (0, Enumerable.Repeat<nfloat> (-1f, (int)Table.RowCount));
+ List<nfloat> widths;
+ var rows = (int)Table.RowCount;
+ if (rows > 0) {
+ widths = new List<nfloat> (rows);
+ for (int i = 0; i < rows; ++i) widths.Add (-1f);
+ } else
+ widths = new List<nfloat> ();
ColumnRowWidths.Add (widths);
return tcol;
}
@@ -180,7 +184,7 @@ namespace Xwt.Mac
RowHeights.Add (-1);
foreach (var colWidths in ColumnRowWidths) {
colWidths.Clear ();
- colWidths.AddRange (Enumerable.Repeat<nfloat> (-1, source.RowCount));
+ for (int i = 0; i < source.RowCount; ++i) colWidths.Add (-1f);
}
tsource = new ListSource (source);