Beispiel #1
0
        public void Bind(ExtendedListBox list)
        {
            listbox = list;
            listbox.LayoutUpdated += OnLayoutUpdate;
            scrollViewer           = listbox.Descendants().OfType <ScrollViewer>().FirstOrDefault();
            scrollOffsetMargin     = 0.5 * scrollViewer.ViewportHeight;

            Bound = true;
        }
Beispiel #2
0
        public void Bind(ExtendedListBox listbox)
        {
            lb = listbox;

            Deployment.Current.Dispatcher.InvokeIfRequired(() => {
                scrollViewer              = listbox.Descendants().OfType <ScrollViewer>().FirstOrDefault();
                lb.ManipulationCompleted += lb_ManipulationCompleted;
            });


            Bound = true;
        }
Beispiel #3
0
        public void Bind(ExtendedListBox listbox)
        {
            lb = listbox;

            scrollViewer = lb.Descendants().OfType <ScrollViewer>().FirstOrDefault();

            if (scrollViewer == null)
            {
                throw new NotSupportedException("ExtendedListbox must have an underlying ScrollViewer");
            }

            lb.ManipulationCompleted += lb_ManipulationCompleted;

            Bound = true;
        }
Beispiel #4
0
        private ITweetable GetFirstVisibleItem()
        {
            var items = lb.ViewportItems;

            if (items.Count == 0)
            {
                return(null);
            }

            var offset       = lb.Descendants().OfType <ViewportControl>().FirstOrDefault().Viewport.Top;
            var visibleItems = items.Where(x => Canvas.GetTop(x.Value) + x.Value.ActualHeight > offset)
                               .OrderBy(x => Canvas.GetTop(x.Value));

            if (visibleItems.Any())
            {
                return(visibleItems.First().Key);
            }
            else
            {
                return(null);
            }
        }