/// <summary> /// Triggers the visual state changes and visual transitions /// to open or close the list to/from selection mode. /// </summary> private void TriggerSelection(SelectionEnabledState state) { IList <WeakReference> items = this.GetItemsInViewPort(); //Only animate the containers in the view port. foreach (var i in items) { MultiselectItem item = (MultiselectItem)(((WeakReference)i).Target); item.State = state; item.UpdateVisualState(true); } Dispatcher.BeginInvoke(() => { for (int j = 0; j < this.Items.Count; j++) { MultiselectItem item = (MultiselectItem)ItemContainerGenerator.ContainerFromIndex(j); if (item != null) { item.State = state; item.UpdateVisualState(false); } } }); }
protected virtual void OnUnselected(RoutedEventArgs e) { if (this._parent != null) { return; } this.State = SelectionEnabledState.Closed; this.UpdateVisualState(true); }
/// <summary> /// Triggers the visual state changes and visual transitions /// to open or close the list to/from selection mode. /// </summary> private void TriggerSelection(SelectionEnabledState state) { IList<WeakReference> items = this.GetItemsInViewPort(); //Only animate the containers in the view port. foreach (var i in items) { MultiselectItem item = (MultiselectItem)(((WeakReference)i).Target); item.State = state; item.UpdateVisualState(true); } Dispatcher.BeginInvoke(() => { for (int j = 0; j < this.Items.Count; j++) { MultiselectItem item = (MultiselectItem)ItemContainerGenerator.ContainerFromIndex(j); if (item != null) { item.State = state; item.UpdateVisualState(false); } } }); }