private void UpdateAccountsPhoneMarksComponentSource(AccountsPhoneMarksComponent newItem, AccountsPhoneMarksComponent oldItem)
        {
            if (oldItem != null)
            {
                oldItem.Change -= AccountsPhoneMarksComponent_Change;
                BindingOperations.ClearBinding(oldItem, AccountsPhoneMarksComponent.AccountProperty);
                BindingOperations.ClearBinding(oldItem, AbstractComponent.IsActiveProperty);
                DependencyPropertyDescriptor.FromProperty(AbstractComponent.ReadOnlyIsLoadedProperty, newItem.GetType())
                    .RemoveValueChanged(oldItem, AccountsPhoneMarksComponent_IsLoadedChanged);
            }

            localCollection.Clear();

            if (newItem != null)
            {
                localCollection.AddRange(newItem.AccountPhoneMarks);
                newItem.Change += AccountsPhoneMarksComponent_Change;

                var accountBinding = new Binding() {
                    Source = this,
                    Path = new PropertyPath(AccountProperty.Name),
                    Mode = BindingMode.OneWay,
                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged };

                var isActiveBinding = new Binding() {
                    Source = this,
                    Path = new PropertyPath(IsActiveProperty.Name),
                    Mode = BindingMode.OneWay,
                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged };

                BindingOperations.SetBinding(newItem, AccountsPhoneMarksComponent.AccountProperty, accountBinding);
                BindingOperations.SetBinding(newItem, AbstractComponent.IsActiveProperty, isActiveBinding);
                DependencyPropertyDescriptor.FromProperty(AbstractComponent.ReadOnlyIsLoadedProperty, newItem.GetType())
                    .AddValueChanged(newItem, AccountsPhoneMarksComponent_IsLoadedChanged);

                this.IsBusy = !AccountsPhoneMarksComponent.IsLoaded;
            }
        }
Esempio n. 2
0
 private void UpdateAccountsPhoneMarksComponentSource(AccountsPhoneMarksComponent newComponent) { }