예제 #1
0
        // Token: 0x06001C30 RID: 7216 RVA: 0x000847A0 File Offset: 0x000829A0
        internal override bool ObtainConvertedProposedValue(BindingGroup bindingGroup)
        {
            bool result = true;

            if (base.NeedsUpdate)
            {
                object obj = bindingGroup.GetValue(this);
                if (obj != DependencyProperty.UnsetValue)
                {
                    obj = this.ConvertProposedValue(obj);
                    object[] array;
                    if (obj == DependencyProperty.UnsetValue)
                    {
                        result = false;
                    }
                    else if ((array = (obj as object[])) != null)
                    {
                        for (int i = 0; i < array.Length; i++)
                        {
                            if (array[i] == DependencyProperty.UnsetValue)
                            {
                                result = false;
                            }
                        }
                    }
                }
                this.StoreValueInBindingGroup(obj, bindingGroup);
            }
            else
            {
                bindingGroup.UseSourceValue(this);
            }
            return(result);
        }
예제 #2
0
        public MainWindow()
        {
            InitializeComponent();

            BindingGroup = new System.Windows.Data.BindingGroup()
            {
                Name = FeedDetailsBindingGroup
            };

            //these bindings can be set in code and are thus more resilient to refactoring
            treeViewFeeds.SetBinding(TreeView.ItemsSourceProperty, new Binding(nameof(MainViewModel.RootItems)));

            textBoxName.SetBinding(TextBox.TextProperty, new Binding(nameof(FeedViewModel.Name))
            {
                Mode             = BindingMode.OneWay,
                BindingGroupName = FeedDetailsBindingGroup
            });
            textBoxUrl.SetBinding(TextBox.TextProperty, new Binding(nameof(FeedViewModel.Url))
            {
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit,
                BindingGroupName    = FeedDetailsBindingGroup
            });

            IsEditing = false;
        }
예제 #3
0
        private static object OnCoerceIsLookup(DependencyObject target, object baseValue)
        {
            var lookup = target as ICrudLookupMode;
            if (lookup != null && (bool)baseValue)
            {
                var uc = target as UIElement;
                if (uc != null)
                {
                    uc.AddHandler(Validation.ErrorEvent, new EventHandler<ValidationErrorEventArgs>(ValidationErrorEventHandler));
                    BindingGroup bg = new BindingGroup();
                    lookup.LookupControl.BindingGroup = bg;
                    uc.SetValue(Validation.ErrorTemplateProperty, null);
                }

                lookup.LookupControl.TemplateApplied -= LookupControl_TemplateApplied;
                lookup.LookupControl.TemplateApplied += LookupControl_TemplateApplied;

                lookup.LookupControl.Dispatcher.BeginInvoke(new Action(() => {
                    var style = GetLookupStyle(target) ?? lookup.LookupControl.TryFindResource("Lookup") as Style;
                    if (style != null && style != lookup.LookupControl.Style)
                        lookup.LookupControl.SetValue(FrameworkElement.StyleProperty, style);
                }),  System.Windows.Threading.DispatcherPriority.Background);
            }

            return baseValue;
        }
예제 #4
0
        //creating a constructor to instantiate relay comamnd objects
        public CategoryViewModel()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            //  dbDataManager = new CategoryContentDataManager();
            UpdateBindingGroup = new System.Windows.Data.BindingGroup {
                Name = "CatContent"
            };
            SelectChangedCommand        = new RelayCommand(DoSelectedChange);
            SelectPSChangedCommand      = new RelayCommand(DoPSSelectChange);
            NewRowCommand               = new RelayCommand(GetNewContent, CanNew);
            SaveCommand                 = new RelayCommand(SaveContent, CanSave);
            DeleteCommand               = new RelayCommand(DeleteContent, CanDelete);
            CheckCommand                = new RelayCommand(DoChecked);
            CancelCommand               = new RelayCommand(DoCancel);
            SelectContentChangedCommand = new RelayCommand(DoSelectChange);
            SaveRowCommand              = new RelayCommand(SaveContent, CanSave);

            IEnumerable <CategoryModel> lstCategory = catRepository.GetCategory("CCLD".Trim());

            if (lstCategory != null)
            {
                SelectedID      = lstCategory.FirstOrDefault().ID;
                SelectedContent = new  ObservableCollection <ContentModel>(catRepository.GetCategoryContent(SelectedID));
            }

            int  minHeight   = 300;
            int  headerRows  = 380;//180+40+30+10;
            var  height      = System.Windows.SystemParameters.PrimaryScreenHeight - headerRows - 50;
            bool validHeight = int.TryParse(height.ToString(), out minHeight);

            this.CategoryHeight = minHeight;


            Mouse.OverrideCursor = null;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CompanyViewModel"/> class.
        /// </summary>
        public CompanyViewModel()
        {
            string currentDirectory = Directory.GetCurrentDirectory();
            // var dataDirectory = ConfigurationManager.AppSettings["DataDirectory"];
            string filePath = Path.Combine(currentDirectory, "DefaultImage.png");

            try
            {
                FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
                Default_photo_aray = new byte[fs.Length];
                fs.Read(Default_photo_aray, 0, Convert.ToInt32(fs.Length));
                fs.Close();
            }
            catch
            {
                //  MessageBox.Show("Error:Can't Read default image of product from " + filePath, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            this.LoadCompanyBackground();


            AddCompanyCommand = new RelayCommand(AddCompany, CanSave);
            // AddShippingAdd = new RelayCommand(AddShipingAddress);
            UpdateBindingGroup = new System.Windows.Data.BindingGroup {
                Name = "Group1"
            };
            //AddCompanyDetailShipAddCommand = new CompositeCommand();
            //AddCompanyDetailShipAddCommand.RegisterCommand(AddCompanyCommand,CanSave);
            //AddCompanyDetailShipAddCommand.RegisterCommand(AddShippingAdd);
            //  DeleteShippingAddress = new RelayCommand(DeleteShipping, CanSaveShippAdd);
            NewShippingAddress   = new RelayCommand(NewShipping, CanSaveShippAdd);
            SameAsBillAdd        = new RelayCommand(SameBillAdd);
            CancelCompanyCommand = new RelayCommand(CancelCompany);
        }
예제 #6
0
 // register the leaf bindings with the binding group
 internal override void UpdateBindingGroup(BindingGroup bg)
 {
     for (int i = 0, n = MutableBindingExpressions.Count - 1; i < n; ++i)
     {
         MutableBindingExpressions[i].UpdateBindingGroup(bg);
     }
 }
예제 #7
0
        private void saveCustomer_Click(object sender, RoutedEventArgs e)
        {
            var btn = sender as Button;
            var container = (FrameworkElement) customerList.ContainerFromElement(btn);

            // If the user is trying to change an items, when another item has an error,
            // display a message and cancel the currently edited item.
            if (_bindingGroupInError != null && _bindingGroupInError != container?.BindingGroup)
            {
                MessageBox.Show("Please correct the data in error before changing another customer");
                container.BindingGroup.CancelEdit();
                return;
            }

            if (container.BindingGroup.ValidateWithoutUpdate())
            {
                container.BindingGroup.UpdateSources();
                _bindingGroupInError = null;
                MessageBox.Show("Item Saved");
            }
            else
            {
                _bindingGroupInError = container.BindingGroup;
            }
        }
 private BaseVM GetBaseVM(BindingGroup group)
 {
     if (group.Items.Count == 0)
     {
         return null;
     }
     return (BaseVM)group.Items[0];
 }
예제 #9
0
        /// <summary>
        /// Store the value in the binding group
        /// </summary>
        internal override void StoreValueInBindingGroup(object value, BindingGroup bindingGroup)
        {
            BindingExpressionBase bindExpr = ActiveBindingExpression;

            if (bindExpr != null)
            {
                bindExpr.StoreValueInBindingGroup(value, bindingGroup);
            }
        }
        // Token: 0x06001C7E RID: 7294 RVA: 0x00085FB8 File Offset: 0x000841B8
        internal override void StoreValueInBindingGroup(object value, BindingGroup bindingGroup)
        {
            BindingExpressionBase activeBindingExpression = this.ActiveBindingExpression;

            if (activeBindingExpression != null)
            {
                activeBindingExpression.StoreValueInBindingGroup(value, bindingGroup);
            }
        }
        //public ObservableCollection<AccountsEntity> AcountList
        //{
        //    get
        //    {
        //        ICashBankDetailsService CashBankDetails = new CashBankDetailsService();
        //        var _accountCollection = new ObservableCollection<AccountsEntity>(CashBankDetails.GetAccountDetails());
        //        return _accountCollection;
        //    }
        //}

        #region Constructor
        public CashBankDetailViewModel()
        {
            this.LoadOptionsBackground();
            ClickSaveCommand   = new RelayCommand(SaveOptions, CanSave);
            ClickNewCommand    = new RelayCommand(NewCommand);
            ClickDeleteCommand = new RelayCommand(DeleteCommand);
            UpdateBindingGroup = new System.Windows.Data.BindingGroup {
                Name = "Group1"
            };
        }
예제 #12
0
        /// <summary>
        /// Run validation rules for the given step, and inform the binding group
        /// <summary>
        internal override bool CheckValidationRules(BindingGroup bindingGroup, ValidationStep validationStep)
        {
            BindingExpressionBase bindExpr = ActiveBindingExpression;

            if (bindExpr != null)
            {
                return(bindExpr.CheckValidationRules(bindingGroup, validationStep));
            }
            return(true);
        }
예제 #13
0
        // Token: 0x06001C2C RID: 7212 RVA: 0x00084428 File Offset: 0x00082628
        internal override void UpdateBindingGroup(BindingGroup bg)
        {
            int i   = 0;
            int num = this.MutableBindingExpressions.Count - 1;

            while (i < num)
            {
                this.MutableBindingExpressions[i].UpdateBindingGroup(bg);
                i++;
            }
        }
예제 #14
0
        /// <summary>
        /// Get the converted proposed value and inform the binding group
        /// <summary>
        internal override bool ObtainConvertedProposedValue(BindingGroup bindingGroup)
        {
            BindingExpressionBase bindExpr = ActiveBindingExpression;

            if (bindExpr != null)
            {
                return(bindExpr.ObtainConvertedProposedValue(bindingGroup));
            }

            return(true);
        }
        //public ObservableCollection<AccountsEntity> AcountList
        //{
        //    get
        //    {
        //        IAccountDetailsService AccountDetails = new AccountDetailsService();
        //        var _accountCollection = new ObservableCollection<AccountsEntity>(AccountDetails.GetAccountDetails());
        //        return _accountCollection;
        //    }
        //}

        #region Constructor
        public AccountDetailViewModel()
        {
            this.LoadOptionsBackground();
            ClickSaveCommand   = new RelayCommand(SaveOptions, CanSave);
            ClickNewCommand    = new RelayCommand(NewCommand);
            ClickDeleteCommand = new RelayCommand(DeleteCommand);
            UpdateBindingGroup = new System.Windows.Data.BindingGroup {
                Name = "Group1"
            };
            PreviousCommand = new RelayCommand(OnPrev);
            NextCommand     = new RelayCommand(OnNext);
        }
        // Token: 0x06001C7D RID: 7293 RVA: 0x00085F84 File Offset: 0x00084184
        internal override bool UpdateSource(BindingGroup bindingGroup)
        {
            bool result = true;
            BindingExpressionBase activeBindingExpression = this.ActiveBindingExpression;

            if (activeBindingExpression != null)
            {
                result = activeBindingExpression.UpdateSource(bindingGroup);
                if (activeBindingExpression.StatusInternal == BindingStatusInternal.UpdateSourceError)
                {
                    base.SetStatus(BindingStatusInternal.UpdateSourceError);
                }
            }
            return(result);
        }
예제 #17
0
        // Token: 0x06001C32 RID: 7218 RVA: 0x000848B4 File Offset: 0x00082AB4
        internal override bool UpdateSource(BindingGroup bindingGroup)
        {
            bool result = true;

            if (base.NeedsUpdate)
            {
                object value = bindingGroup.GetValue(this);
                this.UpdateSource(value);
                if (value == DependencyProperty.UnsetValue)
                {
                    result = false;
                }
            }
            return(result);
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.lstProducts = ((System.Windows.Controls.ListBox)(target));

            #line 19 "..\..\BindingGroupValidation.xaml"
                this.lstProducts.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.lstProducts_SelectionChanged);

            #line default
            #line hidden
                return;

            case 2:

            #line 24 "..\..\BindingGroupValidation.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.cmdGetProducts_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.gridProductDetails = ((System.Windows.Controls.Grid)(target));

            #line 32 "..\..\BindingGroupValidation.xaml"
                this.gridProductDetails.LostFocus += new System.Windows.RoutedEventHandler(this.txt_LostFocus);

            #line default
            #line hidden
                return;

            case 4:
                this.productBindingGroup = ((System.Windows.Data.BindingGroup)(target));
                return;

            case 5:

            #line 78 "..\..\BindingGroupValidation.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.cmdUpdateProduct_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
예제 #19
0
        //public ObservableCollection<AccountsEntity> AcountList
        //{
        //    get
        //    {
        //        IAccountDetailsService AccountDetails = new AccountDetailsService();
        //        var _accountCollection = new ObservableCollection<AccountsEntity>(AccountDetails.GetAccountDetails());
        //        return _accountCollection;
        //    }
        //}

        #region Constructor
        public AccountDetailViewModel()
        {
            this.LoadOptionsBackground();
            ClickSaveCommand   = new RelayCommand(SaveOptions, CanSave);
            ClickNewCommand    = new RelayCommand(NewCommand);
            ClickDeleteCommand = new RelayCommand(DeleteCommand);
            UpdateBindingGroup = new System.Windows.Data.BindingGroup {
                Name = "Group1"
            };
            PreviousCommand     = new RelayCommand(OnPrev);
            NextCommand         = new RelayCommand(OnNext);
            EnterClosingBalance = new RelayCommand(ClosingBalanceForm);
            //ActiveInactive = new RelayCommand(GetSelectedValue);
            StartFinancialCommand = new RelayCommand(StartNewFinancial);
            CloseCommand          = new DelegateCommand(Close);
        }
예제 #20
0
        /// <summary>
        /// Update the source value and inform the binding group
        /// <summary>
        internal override bool UpdateSource(BindingGroup bindingGroup)
        {
            bool result = true;
            BindingExpressionBase bindExpr = ActiveBindingExpression;

            if (bindExpr != null)
            {
                result = bindExpr.UpdateSource(bindingGroup);

                if (bindExpr.StatusInternal == BindingStatusInternal.UpdateSourceError)
                {
                    SetStatus(BindingStatusInternal.UpdateSourceError);
                }
            }
            return(result);
        }
예제 #21
0
 // Token: 0x06001C35 RID: 7221 RVA: 0x00084A00 File Offset: 0x00082C00
 internal override bool CheckValidationRules(BindingGroup bindingGroup, ValidationStep validationStep)
 {
     if (!base.NeedsValidation)
     {
         return(true);
     }
     if (validationStep <= ValidationStep.CommittedValue)
     {
         object value = bindingGroup.GetValue(this);
         bool   flag  = this.Validate(value, validationStep);
         if (flag && validationStep == ValidationStep.CommittedValue)
         {
             base.NeedsValidation = false;
         }
         return(flag);
     }
     throw new InvalidOperationException(SR.Get("ValidationRule_UnknownStep", new object[]
     {
         validationStep,
         bindingGroup
     }));
 }
예제 #22
0
 // Token: 0x06001C33 RID: 7219 RVA: 0x000848E8 File Offset: 0x00082AE8
 internal override void StoreValueInBindingGroup(object value, BindingGroup bindingGroup)
 {
     bindingGroup.SetValue(this, value);
     object[] array = value as object[];
     if (array != null)
     {
         int num = this.MutableBindingExpressions.Count;
         if (array.Length < num)
         {
             num = array.Length;
         }
         for (int i = 0; i < num; i++)
         {
             this.MutableBindingExpressions[i].StoreValueInBindingGroup(array[i], bindingGroup);
         }
         return;
     }
     for (int j = this.MutableBindingExpressions.Count - 1; j >= 0; j--)
     {
         this.MutableBindingExpressions[j].StoreValueInBindingGroup(DependencyProperty.UnsetValue, bindingGroup);
     }
 }
예제 #23
0
 /// <summary>
 /// Run validation rules for the given step, and inform the binding group
 /// <summary>
 internal override bool CheckValidationRules(BindingGroup bindingGroup, ValidationStep validationStep)
 {
     BindingExpressionBase bindExpr = ActiveBindingExpression;
     if (bindExpr != null)
     {
         return bindExpr.CheckValidationRules(bindingGroup, validationStep);
     }
     return true;
 }
예제 #24
0
        /// <summary>
        ///     Called when the Columns collection changes.
        /// </summary>
        private void OnRowValidationRulesChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            BindingGroup itemBindingGroup = ItemBindingGroup;

            if (itemBindingGroup == null)
            {
                ItemBindingGroup = itemBindingGroup = new BindingGroup();
                _rowValidationBindingGroup = itemBindingGroup;
            }

            // only update the ItemBindingGroup if it's not user created.
            if (_rowValidationBindingGroup != null)
            {
                if (object.ReferenceEquals(itemBindingGroup, _rowValidationBindingGroup))
                {
                    switch (e.Action)
                    {
                        case NotifyCollectionChangedAction.Add:
                            foreach (ValidationRule rule in e.NewItems)
                            {
                                _rowValidationBindingGroup.ValidationRules.Add(rule);
                            }

                            break;

                        case NotifyCollectionChangedAction.Remove:
                            foreach (ValidationRule rule in e.OldItems)
                            {
                                _rowValidationBindingGroup.ValidationRules.Remove(rule);
                            }

                            break;

                        case NotifyCollectionChangedAction.Replace:
                            foreach (ValidationRule rule in e.OldItems)
                            {
                                _rowValidationBindingGroup.ValidationRules.Remove(rule);
                            }

                            foreach (ValidationRule rule in e.NewItems)
                            {
                                _rowValidationBindingGroup.ValidationRules.Add(rule);
                            }

                            break;

                        case NotifyCollectionChangedAction.Reset:
                            _rowValidationBindingGroup.ValidationRules.Clear();
                            break;
                    }
                }
                else
                {
                    _rowValidationBindingGroup = null;
                }
            }
        }
 // register the leaf bindings with the binding group
 internal override void UpdateBindingGroup(BindingGroup bg)
 {
     bg.UpdateTable(this);
 }
 /// <summary>
 /// Store the value in the binding group
 /// </summary>
 internal override void StoreValueInBindingGroup(object value, BindingGroup bindingGroup)
 {
     bindingGroup.SetValue(this, value);
 }
예제 #27
0
 /// <summary>
 /// Store the value in the binding group
 /// </summary>
 internal override void StoreValueInBindingGroup(object value, BindingGroup bindingGroup)
 {
     BindingExpressionBase bindExpr = ActiveBindingExpression;
     if (bindExpr != null)
     {
         bindExpr.StoreValueInBindingGroup(value, bindingGroup);
     }
 }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.maingrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.gridRowBanner = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 3:
                this.gridRowFormContent = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 4:
                this.gridBanner = ((System.Windows.Controls.Grid)(target));
                return;

            case 5:
                this.colIcon = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 6:
                this.colIDStatus = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 7:
                this.colLabels = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 8:
                this.colData = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 9:
                this.colCreatedOnLabels = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 10:
                this.colCreatedOn = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 11:
                this.colPadding = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 12:
                this.rowTop = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 13:
                this.rowBottom = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 14:
                this.imgSuperGridBrand = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 15:
                this.bdrTemplateBG = ((System.Windows.Controls.Border)(target));
                return;

            case 16:
                this.imageActivityIcon = ((System.Windows.Controls.Image)(target));
                return;

            case 17:
                this.textActivityId = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 18:
                this.CopyIdCommandBinding = ((System.Windows.Input.CommandBinding)(target));
                return;

            case 19:
                this.textActivityStatus = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 20:
                this.textParentWorkItem = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 21:

            #line 92 "..\..\..\Views\CiresonTimerActivityUserControl.xaml"
                ((System.Windows.Documents.Hyperlink)(target)).Click += new System.Windows.RoutedEventHandler(this.Hyperlink_Click);

            #line default
            #line hidden
                return;

            case 22:
                this.textCreatedOnLabel = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 23:
                this.textCreatedOn = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 24:
                this.tabControl = ((System.Windows.Controls.TabControl)(target));
                return;

            case 25:
                this.tabGeneral = ((System.Windows.Controls.TabItem)(target));
                return;

            case 26:
                this.labelTitle = ((System.Windows.Controls.Label)(target));
                return;

            case 27:
                this.textTitle = ((System.Windows.Controls.TextBox)(target));
                return;

            case 28:
                this.labelDescription = ((System.Windows.Controls.Label)(target));
                return;

            case 29:
                this.textDescription = ((System.Windows.Controls.TextBox)(target));
                return;

            case 30:
                this.labelTimeChoice = ((System.Windows.Controls.Label)(target));
                return;

            case 31:
                this.panelTimeControls = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 32:
                this.bindingGroupTimeFrame = ((System.Windows.Data.BindingGroup)(target));
                return;

            case 33:
                this.rdbTimeFrameTypeSpecificDateTime = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 34:
                this.panelTimeFrameSpecificDateTime = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 35:
                this.lblTimeFrameTypeSpecificDateTime = ((System.Windows.Controls.Label)(target));
                return;

            case 36:
                this.borderTimeFrameSpecificDateTime = ((System.Windows.Controls.Border)(target));
                return;

            case 37:
                this.dateScheduledEndDate = ((Xceed.Wpf.Toolkit.DateTimePicker)(target));
                return;

            case 38:
                this.rdbTimeFrameTypeDuration = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 39:
                this.panelTimeFrameDuration = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 40:
                this.lblTimeFrameTypeDuration = ((System.Windows.Controls.Label)(target));
                return;

            case 41:
                this.txtDurationUnits = ((System.Windows.Controls.TextBox)(target));
                return;

            case 42:
                this.cbxDurationEnum = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 43:
                this.lblTimeControlsError = ((System.Windows.Controls.Label)(target));
                return;

            case 44:
                this.paneltestconfirmation = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 45:
                this.btnOk = ((System.Windows.Controls.Button)(target));
                return;

            case 46:
                this.btnCancel = ((System.Windows.Controls.Button)(target));
                return;

            case 47:
                this.lblisGuiTestMode = ((System.Windows.Controls.Label)(target));
                return;

            case 48:
                this.tabRelatedItems = ((System.Windows.Controls.TabItem)(target));
                return;

            case 49:
                this.tabHistory = ((System.Windows.Controls.TabItem)(target));
                return;
            }
            this._contentLoaded = true;
        }
예제 #29
0
 /// <summary>
 ///     This method is invoked when the ItemBindingGroup property changes.
 /// </summary>
 /// <param name="oldItemBindingGroup">The old value of the ItemBindingGroup property.</param>
 /// <param name="newItemBindingGroup">The new value of the ItemBindingGroup property.</param>
 protected virtual void OnItemBindingGroupChanged(BindingGroup oldItemBindingGroup, BindingGroup newItemBindingGroup)
 {
 }
예제 #30
0
 // register the leaf bindings with the binding group
 internal override void UpdateBindingGroup(BindingGroup bg)
 {
     for (int i=0, n=MutableBindingExpressions.Count-1; i<n; ++i)
     {
         MutableBindingExpressions[i].UpdateBindingGroup(bg);
     }
 }
예제 #31
0
        public ViewModelWindow5()
        {
            personnel = new PersonnelBusinessObject();
            personnel.PeopleChanged += new EventHandler(personnel_PeopleChanged);

            CancelCommand = new RelayCommand(DoCancel);
            SaveCommand = new RelayCommand(DoSave);
            AddUserCommand = new RelayCommand(AddUser);
            DeleteUserCommand = new RelayCommand(DeleteUser);

            UpdateBindingGroup = new BindingGroup { Name = "Group1" };

            checkStatusTimer = new DispatcherTimer();
            checkStatusTimer.Interval = TimeSpan.FromMilliseconds(500);
            checkStatusTimer.Tick += new EventHandler(CheckStatus);
            checkStatusTimer.Start();

            CheckStatus(null, null);
        }
        // Token: 0x06001C7B RID: 7291 RVA: 0x00085F2C File Offset: 0x0008412C
        internal override bool ObtainConvertedProposedValue(BindingGroup bindingGroup)
        {
            BindingExpressionBase activeBindingExpression = this.ActiveBindingExpression;

            return(activeBindingExpression == null || activeBindingExpression.ObtainConvertedProposedValue(bindingGroup));
        }
예제 #33
0
    /// <summary>
    /// Get the converted proposed value and inform the binding group
    /// <summary>
    internal override bool ObtainConvertedProposedValue(BindingGroup bindingGroup)
    {
        BindingExpressionBase bindExpr = ActiveBindingExpression;
        if (bindExpr != null)
        {
            return bindExpr.ObtainConvertedProposedValue(bindingGroup);
        }

        return true;
    }
예제 #34
0
    /// <summary>
    /// Update the source value and inform the binding group
    /// <summary>
    internal override bool UpdateSource(BindingGroup bindingGroup)
    {
        bool result = true;
        BindingExpressionBase bindExpr = ActiveBindingExpression;
        if (bindExpr != null)
        {
            result = bindExpr.UpdateSource(bindingGroup);

            if (bindExpr.StatusInternal == BindingStatusInternal.UpdateSourceError)
            {
                SetStatus(BindingStatusInternal.UpdateSourceError);
            }
        }
        return result;
    }
예제 #35
0
 /// <summary>
 /// Update the source value and inform the binding group
 /// <summary>
 internal abstract bool UpdateSource(BindingGroup bindingGroup); 
예제 #36
0
        private void RemoveBindingExpressions(BindingGroup bindingGroup, DependencyObject element)
        {
            if (element == null)
                return; // no content, hence no bindings to remove

            var bindingExpressions = bindingGroup.BindingExpressions;
            BindingExpressionBase[] bindingExpressionsCopy = new BindingExpressionBase[bindingExpressions.Count];
            bindingExpressions.CopyTo(bindingExpressionsCopy, 0);

            for (int i = 0; i < bindingExpressionsCopy.Length; i++)
            {
                // Check the binding's target element - it might have been GC'd
                // (this can happen when column-virtualization is enabled, see Dev11 131232).
                // If so, fetching TargetElement will detach the binding and remove it
                // from the binding group's collection.  This side-effect is why we
                // loop through a copy of the original collection, and don't rely
                // on i to be a valid index into the original collection.
                DependencyObject targetElement = bindingExpressionsCopy[i].TargetElement;
                if (targetElement != null &&
                    VisualTreeHelper.IsAncestorOf(element, targetElement, typeof(DataGridCell)))
                {
                    bindingExpressions.Remove(bindingExpressionsCopy[i]);
                }
            }
        }
예제 #37
0
 /// <summary>
 /// Store the value in the binding group 
 /// </summary> 
 internal abstract void StoreValueInBindingGroup(object value, BindingGroup bindingGroup);
        private void RemoveBindingExpressions(BindingGroup bindingGroup, DependencyObject element)
        {
            // Walk the logical tree  looking for BindingBindingExpressions.
            // If it is found in the BindingGroup's BindingExpression list we will remove it.
            // We only search the logical tree for perf reasons, so some visual children could be skipped.  This 
            // should be ok for all the stock columns, and will be something that a custom column would need to be
            // aware of.
            if (element != null)
            {
                var bindingExpressions = bindingGroup.BindingExpressions;
                var localValueEnumerator = element.GetLocalValueEnumerator();
                while (localValueEnumerator.MoveNext())
                {
                    var bindingExpression = localValueEnumerator.Current.Value as BindingExpression;
                    if (bindingExpression != null)
                    {
                        for (int i = 0; i < bindingExpressions.Count; i++)
                        {
                            if (object.ReferenceEquals(bindingExpression, bindingExpressions[i]))
                            {
                                bindingExpressions.RemoveAt(i--);
                            }
                        }
                    }
                }

                // Recursively remove BindingExpressions from child elements.
                foreach (object child in LogicalTreeHelper.GetChildren(element))
                {
                    RemoveBindingExpressions(bindingGroup, child as DependencyObject);
                }
            }
        }
        // Token: 0x06001C80 RID: 7296 RVA: 0x00085FFC File Offset: 0x000841FC
        internal override bool CheckValidationRules(BindingGroup bindingGroup, ValidationStep validationStep)
        {
            BindingExpressionBase activeBindingExpression = this.ActiveBindingExpression;

            return(activeBindingExpression == null || activeBindingExpression.CheckValidationRules(bindingGroup, validationStep));
        }
        /// <summary>
        /// Get the converted proposed value and inform the binding group
        /// <summary>
        internal override bool ObtainConvertedProposedValue(BindingGroup bindingGroup)
        {
            bool result = true;
            object value;

            if (NeedsUpdate)
            {
                value = bindingGroup.GetValue(this);
                if (value != DependencyProperty.UnsetValue)
                {
                    value = ConvertProposedValue(value);
                    if (value == DependencyProperty.UnsetValue)
                    {
                        result = false;
                    }
                }
            }
            else
            {
                value = BindingGroup.DeferredSourceValue;
            }

            bindingGroup.SetValue(this, value);
            return result;
        }
예제 #41
0
    /// <summary>
    /// Store the value in the binding group
    /// </summary>
    internal override void StoreValueInBindingGroup(object value, BindingGroup bindingGroup)
    {
        bindingGroup.SetValue(this, value);

        object[] values = value as object[];
        if (values != null)
        {
            int count = MutableBindingExpressions.Count;
            if (values.Length < count)
                count = values.Length;

            for (int i=0; i<count; ++i)
            {
                MutableBindingExpressions[i].StoreValueInBindingGroup(values[i], bindingGroup);
            }
        }
        else
        {
            for (int i=MutableBindingExpressions.Count-1; i>=0; --i)
            {
                MutableBindingExpressions[i].StoreValueInBindingGroup(DependencyProperty.UnsetValue, bindingGroup);
            }
        }
    }
예제 #42
0
 private void SetupValidationRules()
 {
     BindingGroup group = new BindingGroup();
     group.ValidationRules.Add(new FilterValidation(this.Model));
     this.txtFilterText.BindingGroup = group;
 }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.lstProducts = ((System.Windows.Controls.ListBox)(target));
     
     #line 20 "..\..\..\Ch19_Databinding\BindingGroupValidation.xaml"
     this.lstProducts.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.lstProducts_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 2:
     
     #line 25 "..\..\..\Ch19_Databinding\BindingGroupValidation.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.cmdGetProducts_Click);
     
     #line default
     #line hidden
     return;
     case 3:
     this.gridProductDetails = ((System.Windows.Controls.Grid)(target));
     
     #line 33 "..\..\..\Ch19_Databinding\BindingGroupValidation.xaml"
     this.gridProductDetails.LostFocus += new System.Windows.RoutedEventHandler(this.txt_LostFocus);
     
     #line default
     #line hidden
     return;
     case 4:
     this.productBindingGroup = ((System.Windows.Data.BindingGroup)(target));
     return;
     case 5:
     
     #line 79 "..\..\..\Ch19_Databinding\BindingGroupValidation.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.cmdUpdateProduct_Click);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
예제 #44
0
    /// <summary>
    /// Get the converted proposed value and inform the binding group
    /// <summary>
    internal override bool ObtainConvertedProposedValue(BindingGroup bindingGroup)
    {
        bool result = true;
        if (NeedsUpdate)
        {
            object value = bindingGroup.GetValue(this);
            if (value != DependencyProperty.UnsetValue)
            {
                object[] values;
                value = ConvertProposedValue(value);

                if (value == DependencyProperty.UnsetValue)
                {
                    result = false;
                }
                else if ((values = value as object[]) != null)
                {
                    for (int i=0; i<values.Length; ++i)
                    {
                        if (values[i] == DependencyProperty.UnsetValue)
                        {
                            result = false;
                        }
                    }
                }
            }
            StoreValueInBindingGroup(value, bindingGroup);
        }
        else
        {
            bindingGroup.UseSourceValue(this);
        }

        return result;
    }
 /// <summary>
 /// Update the source value and inform the binding group
 /// <summary>
 internal override bool UpdateSource(BindingGroup bindingGroup)
 {
     bool result = true;
     if (NeedsUpdate)
     {
         object value = bindingGroup.GetValue(this);
         value = UpdateSource(value);
         bindingGroup.SetValue(this, value);
         if (value == DependencyProperty.UnsetValue)
         {
             result = false;
         }
     }
     return result;
 }
예제 #46
0
 /// <summary> 
 /// Run validation rules for the given step, and inform the binding group
 /// <summary>
 internal abstract bool CheckValidationRules(BindingGroup bindingGroup, ValidationStep validationStep);
        /// <summary>
        /// Run validation rules for the given step, and inform the binding group
        /// <summary>
        internal override bool CheckValidationRules(BindingGroup bindingGroup, ValidationStep validationStep)
        {
            if (!NeedsValidation)
                return true;

            object value;
            switch (validationStep)
            {
                case ValidationStep.RawProposedValue:
                    value = GetRawProposedValue();
                    break;
                case ValidationStep.ConvertedProposedValue:
                    value = bindingGroup.GetValue(this);
                    break;
                case ValidationStep.UpdatedValue:
                case ValidationStep.CommittedValue:
                    value = this;
                    break;
                default:
                    throw new InvalidOperationException(SR.Get(SRID.ValidationRule_UnknownStep, validationStep, bindingGroup));
            }

            return Validate(value, validationStep);
        }
예제 #48
0
        // add a binding to the given binding group 
        internal void JoinBindingGroup(BindingGroup bg, bool explicitJoin)
        { 
            BindingExpressionBase root = null;  // set to non-null by the next loop

            for (   BindingExpressionBase bindingExpr = this;
                    bindingExpr != null; 
                    bindingExpr = bindingExpr.ParentBindingExpressionBase)
            { 
                root = bindingExpr; 

                // bindings in a group update Explicitly, unless declared otherwise 
                bindingExpr.OnBindingGroupChanged(/*joining*/true);

                bg.AddToValueTable(bindingExpr);
            } 

            // add the root binding to the group 
            if (root._bindingGroup == null) 
            {
                // use WeakReference because the BindingGroup contains a strong reference 
                // to the visual tree (via InheritanceContext)
                root._bindingGroup = new WeakReference(bg);

                // when the group is implicitly discovered, always add the root binding to the group's collection. 
                // When the binding is added explicitly - via BindingGroup.BindingExpressions.Add() -
                // check first to see if it has already been added 
                bool addToGroup = explicitJoin ? !bg.BindingExpressions.Contains(root) : true; 
                if (addToGroup)
                { 
                    bg.BindingExpressions.Add(root);
                }

                // in the explicit case, register its items and values with the binding group 
                // (the implicit case does this when the bindings activate)
                if (explicitJoin) 
                { 
                    root.UpdateBindingGroup(bg);
 
                    if (bg.SharesProposedValues && TraceData.IsEnabled)
                    {
                        TraceData.Trace(TraceEventType.Warning,
                                TraceData.SharesProposedValuesRequriesImplicitBindingGroup( 
                                        TraceData.Identify(root),
                                        root.ParentBindingBase.BindingGroupName, 
                                        TraceData.Identify(bg))); 
                    }
                } 
            }
            else
            {
                if (root.BindingGroup != bg) 
                    throw new InvalidOperationException(SR.Get(SRID.BindingGroup_CannotChangeGroups));
            } 
        } 
예제 #49
0
        private void GroupBindingExpressions()
        {
            UserDetail = new BindingGroup();
            var txts = new List<TextBox> { TxtFirstName, TxtSecondName };
            var txtDP = TextBox.TextProperty;
            var allExps = UserDetail.BindingExpressions;
            txts.ForEach(txt =>
            {
                var exp = txt.GetBindingExpression(txtDP);
                allExps.Add(exp);
                determinantUserExpressions.Add(exp);
            });

            var combos = new List<ComboBox> { cbCountry, cbSubdivision, cbLocation };
            var valDP = ComboBox.SelectedValueProperty;
            txtDP = ComboBox.TextProperty;
            combos.ForEach(cb =>
            {
                var exp = cb.GetBindingExpression(valDP);
                allExps.Add(exp);
                determinantUserExpressions.Add(exp);

                exp = cb.GetBindingExpression(txtDP);
                allExps.Add(exp);
            });
        }
예제 #50
0
 // register the leaf bindings with the binding group 
 internal abstract void UpdateBindingGroup(BindingGroup bg); 
예제 #51
0
파일: DataGrid.cs 프로젝트: JianwenSun/cc
 // Set the ItemBindingGroup property, if the user hasn't done so already
 private void EnsureItemBindingGroup()
 {
     if (ItemBindingGroup == null)
     {
         _defaultBindingGroup = new BindingGroup();
         SetCurrentValue(ItemBindingGroupProperty, _defaultBindingGroup);
     }
 }
예제 #52
0
 /// <summary> 
 /// Get the converted proposed value and inform the binding group
 /// <summary>
 internal abstract bool ObtainConvertedProposedValue(BindingGroup bindingGroup);