예제 #1
0
        private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
        {
            if ((int)(e.VerticalOffset / (e.ExtentHeight - e.ViewportHeight) * 100) >= _ratioTriggeringScroll)
            {
                if (Items.Count < Data.Count)
                {
                    int itemsCount = Items.Count;

                    for (int i = itemsCount; i < (itemsCount + _muchToOutput < Data.Count ? itemsCount + _muchToOutput : Data.Count); i++)
                    {
                        var item = Activator.CreateInstance(TypesBlockViewItem.Find(t => t.Name == TypeItem.ToString())) as BlockViewItem;
                        item.VerticalAlignment   = VerticalAlignment.Top;
                        item.HorizontalAlignment = HorizontalAlignment.Stretch;
                        item.Margin = new Thickness(0, 10 + (i * (item.Height + 10)), 10, 0);
                        item.Data   = Data[i];
                        item.Click += Item_Click;
                        Items.Add(item);

                        RenderContorl(item);
                    }
                }
            }
        }
예제 #2
0
        private void GenerateItems()
        {
            Items.Clear();

            for (int i = 0; i < (Data.Count > _startupToOutput ? _startupToOutput : Data.Count); i++)
            {
                BlockViewItem item = Activator.CreateInstance(TypesBlockViewItem.Find(t => t.Name == TypeItem.ToString())) as BlockViewItem;
                item.VerticalAlignment   = VerticalAlignment.Top;
                item.HorizontalAlignment = HorizontalAlignment.Stretch;
                item.Margin = new Thickness(0, 10 + (i * (item.Height + 10)), 10, 0);
                item.Data   = Data[i];
                item.Click += Item_Click;
                Items.Add(item);
            }
        }