private void SetStartPositions(List <NativeItemData> nid) { int c = 0; StartPositions.Clear(); if (ItemCount == 0) { _ActiveListHeight = 0; _ActiveListWidth = 0; return; } for (int i = 0; i < ItemCount; i++) { StartPositions.Add(c); if (ShowGroupHeader) { //if (IsItemNewGroup(nItem) && item.Group != null && rItem.Top >= rListRect.Top) if (IsItemNewGroup(i) && nid[i].Group != null) { c += Settings.GroupPixHeight; } } c += Settings.ListItemPixSize; } StartPositions.Add(c); //The end of tha last item _ActiveListHeight = c; ScrollTo(0); }
protected override void CalculateItemsSize() { StartPositions.Clear(); if (Canvas.Children.Count == 0) { _ActiveListHeight = 0; _ActiveListWidth = 0; return; } StartPositions.Add(0); UIElementBase element = Canvas.Children[0]; int max = element.Bottom; for (int i = 1; i < Canvas.Children.Count; i++) { element = Canvas.Children[i]; max = Math.Max(max, element.Bottom); } int v = max + BottomPadding; StartPositions.Add(v); _ActiveListHeight = v; }
private void SetStartPositions(List <NativeItemData> nid) { int c = 0; StartPositions.Clear(); if (ItemCount == 0) { _ActiveListHeight = 0; _ActiveListWidth = 0; return; } var hdcMem = OffScreenGraphics.GetHdc(); try { using (Gdi g = Gdi.FromHdc(hdcMem, Rectangle.Empty)) { g.Font = Settings.SecondaryTextFontGdi; g.TextAlign = Win32.TextAlign.TA_LEFT; for (int i = 0; i < ItemCount; i++) { StartPositions.Add(c); //nid[i].SecondaryTextLines = TextFormatHelper.CutTextToLines(nid[i].SecondaryText, Width - UISettings.CalcPix(40), 0, g); nid[i].SecondaryTextLines = TextFormatHelper.CutTextToLines(nid[i].SecondaryText, Width - UISettings.CalcPix(29), Settings.SecondaryTextLinesCount, g); //SecondaryTextLinesCount c += (Settings.ListItemPixSize + (nid[i].SecondaryTextLines.Count + 1) * UISettings.CalcPix(11)); if (ShowGroupHeader) { //if (IsItemNewGroup(nItem) && item.Group != null && rItem.Top >= rListRect.Top) if (IsItemNewGroup(i) && nid[i].Group != null) { c += Settings.GroupPixHeight; } } //c += Settings.ListItemPixSize; } } } finally { OffScreenGraphics.ReleaseHdc(hdcMem); } StartPositions.Add(c); //The end of tha last item _ActiveListHeight = c; ScrollTo(0); }
private void SetStartPositions(List <NativeItemData> nid) { int c = 0; StartPositions.Clear(); if (ItemCount == 0) { _ActiveListHeight = 0; return; } var hdcMem = OffScreenGraphics.GetHdc(); int lastHeight = 0; try { using (Gdi g = Gdi.FromHdc(hdcMem, Rectangle.Empty)) { g.Font = Settings.SecondaryTextFontGdi; g.TextAlign = Win32.TextAlign.TA_LEFT; // для текста в каждой ячейке for (int i = 0; i < ItemCount; i++) { StartPositions.Add(c); nid[i].SecondaryTextLines = TextFormatHelper.CutTextToLines(nid[i].SecondaryText, UISettings.CalcPix(200), 0, g); c += (Settings.ListItemPixSize + (nid[i].SecondaryTextLines.Count + 1) * UISettings.CalcPix(11)); } StartPositions.Add(c); } } finally { OffScreenGraphics.ReleaseHdc(hdcMem); } _ActiveListHeight = c; }
private void SetStartPositions(List <NativeItemData> nid) { int c = 0; StartPositions.Clear(); if (ItemCount == 0) { _ActiveListHeight = 0; return; } var hdcMem = OffScreenGraphics.GetHdc(); try { using (Gdi g = Gdi.FromHdc(hdcMem, Rectangle.Empty)) { g.Font = Settings.SecondaryTextFontGdi; g.TextAlign = Win32.TextAlign.TA_LEFT; // для текста в каждой ячейке for (int i = 0; i < ItemCount; i++) { StartPositions.Add(c); // есть заголовок группы? if (IsItemNewGroup(i) && !string.IsNullOrEmpty(nid[i].Group)) { c += Settings.GroupPixHeight; } // что выводим? switch (Items[i].Type) { case ImageDetailedListViewItemType.Author: // ячейка "автор" c += UISettings.CalcPix(25); break; case ImageDetailedListViewItemType.Comment: // ячейка "комментарий" nid[i].SecondaryTextLines = TextFormatHelper.CutTextToLines(nid[i].SecondaryText, Width - UISettings.CalcPix(10), 0, g); c += (Settings.ListItemPixSize + (nid[i].SecondaryTextLines.Count + 1) * UISettings.CalcPix(11)); break; case ImageDetailedListViewItemType.Photo: if (Items[i].IsPhotoLoaded) { c += Items[i].PhotoHeight; } else { c += UISettings.CalcPix(50); } break; } } } } finally { OffScreenGraphics.ReleaseHdc(hdcMem); } StartPositions.Add(c); _ActiveListHeight = c; ScrollTo(0); }