Exemple #1
0
        /// <summary>
        /// Selected the item as the confirmed selected item.
        /// </summary>
        /// <param name="sender">The split combo box item.</param>
        /// <param name="e">Event Args.</param>
        private void SplitComboBoxItem_ItemSelected(object sender, SelectedEventArgs e)
        {
            this.IsDropDownOpen = false;

            object[] items = IEnumerableHelper.GetItems(this.containersByItem.Keys);
            foreach (object item in items)
            {
                if (item == this.ConfirmedSelectedItem || item.Equals(this.ConfirmedSelectedItem))
                {
                    this.containersByItem[item].IsSelectedValue = false;
                }
            }

            if (e.SelectedItem == this.OtherItem)
            {
                e.Handled = true;

                if (this.ClearConfirmedSelectedItemWhenOtherSelected)
                {
                    this.ConfirmedSelectedItem = null;
                }

                SplitComboBoxItem splitComboBoxItem = sender as SplitComboBoxItem;
                splitComboBoxItem.IsSelectedValue = false;

                if (this.OtherItemsSource != null)
                {
                    this.ShowOtherItems = true;
                }
            }
            else
            {
                this.SelectedItem = e.SelectedItem;
                this.ConfirmedSelectedItem = e.SelectedItem;
            }

            if (e.SelectedItem != this.OtherItem)
            {
                this.RaiseItemSelected();
            }
            else
            {
                if (this.OtherSelected != null)
                {
                    this.OtherSelected(this, EventArgs.Empty);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Checks if other was selected and handles.
        /// </summary>
        /// <param name="sender">The split list box.</param>
        /// <param name="e">Selected Event Args.</param>
        private void SplitListBoxItem_Selected(object sender, SelectedEventArgs e)
        {
            if (e.SelectedItem == this.OtherItem)
            {
                e.Handled = true;
                this.ConfirmedSelectedItem = null;
                SplitListBoxItem splitListBoxItem = sender as SplitListBoxItem;
                splitListBoxItem.IsSelectedValue = false;

                if (this.OtherItemsSource != null)
                {
                    this.ShowOtherItems = true;
                }                

                if (this.OtherSelected != null)
                {
                    this.OtherSelected(this, EventArgs.Empty);
                }                
            }
            else
            {
                this.SelectedItem = e.SelectedItem;
                this.ConfirmedSelectedItem = e.SelectedItem;
                if (this.ConfirmedSelectedItem != null)
                {
                    this.ScrollIntoView(this.ConfirmedSelectedItem);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Collapses the list, if behaviour is not overriden.
        /// </summary>
        /// <param name="sender">The cascading list box item.</param>
        /// <param name="e">Selected Event Args.</param>
        private void CascadingListBoxItem_Selected(object sender, SelectedEventArgs e)
        {
            if (this.CollapseOnSelection && !e.Handled)
            {
                this.IsExpanded = false;
            }

            FocusHelper.FocusControl(this);

            if (e.SelectedItem != this.OtherItem)
            {
                this.RaiseItemSelected();
            }
        }