//handler, when sub UC removed
        void ac_RemoveItem(object sender, EventArgs e)
        {
            AccountSelectorSubelementControl ac = (AccountSelectorSubelementControl)sender;

            AllSelectedItems.Remove(ac.SelectedOtherItem);
            scStackPanel.Children.Remove(ac);
        }
        //clicking on "+" button for adding additional combobox with accounts
        private void btnAddNewAcc_Click(object sender, RoutedEventArgs e)
        {
            AccountSelectorSubelementControl ac = new AccountSelectorSubelementControl();

            ac.RemoveItem += new EventHandler(ac_RemoveItem);
            ac.AddItem    += new EventHandler <AccountsEventArgs>(ac_AddItem);
            scStackPanel.Children.Add(ac);
            ac.ComboBoxItems = userControl.MainComboBoxItems;
        }
        //handler, when sub UC added
        void ac_AddItem(object sender, AccountsEventArgs e)
        {
            AccountSelectorSubelementControl ac = (AccountSelectorSubelementControl)sender;

            if (e.OldObject != null)
            {
                AllSelectedItems.Remove(e.OldObject);
            }
            AllSelectedItems.Add(ac.SelectedOtherItem);
        }
Example #4
0
        public static void OnComboBoxItemsChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            AccountSelectorSubelementControl uc = (AccountSelectorSubelementControl)sender;

            if (e.Property == ComboBoxItemsProperty)
            {
                uc.cmbSvrAcc.Items.Clear();

                foreach (var o in (ObservableCollection <Account>)e.NewValue)
                {
                    uc.cmbSvrAcc.Items.Add(o);
                }
            }
        }
Example #5
0
        public static void OnItemSelected(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            AccountSelectorSubelementControl ac = (AccountSelectorSubelementControl)sender;

            ac.SelectedOtherItem = (Account)e.NewValue;
        }