Beispiel #1
0
        private void Items_ItemsChanged(RadItemCollection changed, RadItem target, ItemsChangeOperation operation)
        {
            RadComboBoxItem comboItem = target as RadComboBoxItem;

            if (comboItem == null)
            {
                return;
            }

            switch (operation)
            {
            case ItemsChangeOperation.Removed:
                if (this.listBoxElement.SelectedItem != null &&
                    this.listBoxElement.SelectedItem.Equals(comboItem))
                {
                    this.listBoxElement.SelectedIndex = -1;
                }
                comboItem.OwnerElement = null;
                break;

            case ItemsChangeOperation.Cleared:
                this.listBoxElement.SelectedIndex = -1;
                break;

            case ItemsChangeOperation.Setting:
                if (this.listBoxElement.SelectedItem != null &&
                    this.listBoxElement.SelectedItem.Equals(comboItem))
                {
                    this.listBoxElement.SelectedIndex = -1;
                }
                comboItem.OwnerElement = null;
                break;

            case ItemsChangeOperation.Inserted:
            case ItemsChangeOperation.Set:
                if (comboItem != null)
                {
                    comboItem.OwnerElement = this.OwnerComboItem;
                }
                break;
            }
        }
Beispiel #2
0
        internal void SetActiveItem(RadComboBoxItem item)
        {
            if (this.ActiveItem == item)
            {
                if (this.ActiveItem == item)
                {
                    return;
                }
            }

            if (this.ActiveItem != null)
            {
                this.ActiveItem.Active = false;
            }
            this.ActiveItem = item;
            if (this.ActiveItem != null)
            {
                this.ActiveItem.Active = true;
            }
        }