private void ScrollToBottomBehavior_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { ListBox listBox = AssociatedObject; bool isb = GetIsScrollToBottom(listBox as DependencyObject); if ((isb) && (e.Action == NotifyCollectionChangedAction.Add)) { this.actorSystemManager = this.actorSystemManager ?? IoC.Get <ActorSystemManager>(); this.actorSystemManager.UiProcessor.Tell(new UiProcessorMessage.QueueBufferedScrollToBottom(listBox, e.NewItems[0])); } }
private void ScrollToBottomBehavior_ListboxSizeChanged(object sender, SizeChangedEventArgs e) { ListBox listBox = AssociatedObject; bool isb = GetIsScrollToBottom(listBox as DependencyObject); if (!isb) { return; } if (listBox.Items.Count <= 0) { return; } var lastItem = listBox.Items[listBox.Items.Count - 1]; this.actorSystemManager = this.actorSystemManager ?? IoC.Get <ActorSystemManager>(); this.actorSystemManager.UiProcessor.Tell(new UiProcessorMessage.QueueBufferedScrollToBottom(listBox, lastItem)); }