コード例 #1
0
        //handler, when sub UC removed
        void ac_RemoveItem(object sender, EventArgs e)
        {
            AccountSelectorSubelementControl ac = (AccountSelectorSubelementControl)sender;

            AllSelectedItems.Remove(ac.SelectedOtherItem);
            scStackPanel.Children.Remove(ac);
        }
コード例 #2
0
        //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;
        }
コード例 #3
0
        //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);
        }
コード例 #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);
                }
            }
        }
コード例 #5
0
        public static void OnItemSelected(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            AccountSelectorSubelementControl ac = (AccountSelectorSubelementControl)sender;

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