protected override void Layout() { var count = Rect.Height / ItemHeight + 1; var index = m_scrollY / ItemHeight; var y = Rect.Y + (index * ItemHeight - m_scrollY); int i = 0; for (; i < count; ++i, ++index) { ListItemRegion <T> r = null; if (i < Children.Count) { r = Children[i] as ListItemRegion <T>; } else { r = m_source.CreateItem(); r.Parent = this; r.MouseLeftClicked += x => R_LeftClicked(x as ListItemRegion <T>); r.MouseLeftDoubleClicked += x => R_LeftDoubleClicked(x as ListItemRegion <T>); Children.Add(r); } r.Rect = new Rect(Rect.X, y, Rect.Width, ItemHeight); if (index < 0 || index >= m_source.Count) { r.SourceIndex = null; } else { r.SourceIndex = index; } y += ItemHeight; } Invalidate(); }