Exemple #1
0
        private void OnComboBoxSelectedIndexChanged(NValueChangeEventArgs args)
        {
            if (m_bSelectionUpdating)
            {
                m_bSelectionUpdating = false;
                return;
            }

            // Get the list box and the other list box
            int       selectedIndex = (int)args.NewValue;
            NComboBox comboBox      = (NComboBox)args.TargetNode;
            NComboBox otherComboBox = comboBox == m_ComboBox ? m_AdvancedComboBox : m_ComboBox;

            // Log the selection
            NComboBoxItem selectedItem = comboBox.SelectedItem;
            NCountry      country      = NNodeCollectionDataBinding <NComboBoxItemCollection, NComboBoxItem, NCountry> .GetDataBoundItem(selectedItem);

            m_EventsLog.LogEvent("'" + country.Name + "' selected");

            // Synchronize the selection between the two list boxes
            m_bSelectionUpdating        = true;
            otherComboBox.SelectedIndex = selectedIndex;
        }
Exemple #2
0
        private void OnListBoxItemSelected(NSelectEventArgs <NListBoxItem> args)
        {
            if (m_bSelectionUpdating)
            {
                m_bSelectionUpdating = false;
                return;
            }

            // Get the list box and the other list box
            NListBox listBox      = (NListBox)args.Item.OwnerListBox;
            NListBox otherListBox = listBox == m_ListBox ? m_AdvancedListBox : m_ListBox;

            // Log the selection
            NListBoxItem selectedItem = listBox.Selection.FirstSelected;
            NCountry     country      = NNodeCollectionDataBinding <NListBoxItemCollection, NListBoxItem, NCountry> .GetDataBoundItem(selectedItem);

            m_EventsLog.LogEvent("'" + country.Name + "' selected");

            // Synchronize the selection between the two list boxes
            m_bSelectionUpdating = true;
            int selectedIndex = listBox.Items.IndexOf(selectedItem);

            otherListBox.Selection.SingleSelect(otherListBox.Items[selectedIndex]);
        }