private void UpdateAccountsImportQueueRecordsComponentSource(AccountsImportQueueRecordsComponent newItem, AccountsImportQueueRecordsComponent oldItem)
        {
            if (oldItem != null)
            {
                oldItem.Change -= AccountsImportQueueRecordsComponent_Change;
                BindingOperations.ClearBinding(oldItem, AccountsImportQueueRecordsComponent.AccountProperty);
                BindingOperations.ClearBinding(oldItem, AbstractComponent.IsActiveProperty);
                DependencyPropertyDescriptor.FromProperty(AbstractComponent.ReadOnlyIsLoadedProperty, oldItem.GetType())
                    .RemoveValueChanged(oldItem, AccountsImportQueueRecordsComponent_IsLoadedChanged);
            }

            localCollection.Clear();

            if (newItem != null)
            {
                localCollection.AddRange(newItem.ImportQueueRecords);
                newItem.Change += AccountsImportQueueRecordsComponent_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, AccountsImportQueueRecordsComponent.AccountProperty, accountBinding);
                BindingOperations.SetBinding(newItem, AbstractComponent.IsActiveProperty, isActiveBinding);
                DependencyPropertyDescriptor.FromProperty(AbstractComponent.ReadOnlyIsLoadedProperty, newItem.GetType())
                    .AddValueChanged(newItem, AccountsImportQueueRecordsComponent_IsLoadedChanged);

                this.IsBusy = !AccountsImportQueueRecordsComponent.IsLoaded;
            }
        }
Example #2
0
 private void UpdateAccountsImportQueueRecordsComponentSource(AccountsImportQueueRecordsComponent newComponent) { }