protected bool AddVisibleChildren(int desiredDisplayCount) { var screenTopRowIndex = GetScreenTopRowIndex(); if (desiredDisplayCount <= Children.Count) { return(false); } Debug.Print("BuildVisibleChildren ({0})", desiredDisplayCount - Children.Count); for (var i = Children.Count; i < desiredDisplayCount; i++) { var listBoxItem = new ElementListBoxItem { Height = RowHeight, ContentTemplate = ItemTemplate }; //x listBoxItem.MouseLeftButtonDown += ContentMouseLeftButtonDown; var dataRowIndex = Children.Add(listBoxItem) + screenTopRowIndex; listBoxItem.Content = ItemsSource[dataRowIndex]; } return(true); }
protected bool AddVisibleChildren(int desiredDisplayCount) { var screenTopRowIndex = GetScreenTopRowIndex(); if (desiredDisplayCount <= Children.Count) return false; Debug.Print("BuildVisibleChildren ({0})",desiredDisplayCount - Children.Count); for (var i = Children.Count; i < desiredDisplayCount; i++) { var listBoxItem = new ElementListBoxItem { Height = RowHeight, ContentTemplate = ItemTemplate }; //x listBoxItem.MouseLeftButtonDown += ContentMouseLeftButtonDown; var dataRowIndex = Children.Add(listBoxItem) + screenTopRowIndex; listBoxItem.Content = ItemsSource[dataRowIndex]; } return true; }