Beispiel #1
0
 void BindEditors()
 {
     StatusImageComboBoxEdit.Properties.Items.AddEnum <EmployeeStatus>();
     EditorHelpers.CreatePersonPrefixImageComboBox(PrefixImageComboBoxEdit.Properties, null);
     colPriority.ColumnEdit = EditorHelpers.CreateTaskPriorityImageComboBox(null, gridControlTasks.RepositoryItems);
     DepartmentImageComboBoxEdit.Properties.Items.AddEnum <EmployeeDepartment>();
     StateImageComboBoxEdit.Properties.Items.AddEnum <StateEnum>();
     //
     ZipCodeTextEdit.DataBindings.Add(new Binding("EditValue", bindingSource, "Address.ZipCode", true, DataSourceUpdateMode.OnPropertyChanged));
     StateImageComboBoxEdit.DataBindings.Add(new Binding("EditValue", bindingSource, "Address.State", true, DataSourceUpdateMode.OnPropertyChanged));
     CityTextEdit.DataBindings.Add(new Binding("EditValue", bindingSource, "Address.City", true, DataSourceUpdateMode.OnPropertyChanged));
     AddressTextEdit.DataBindings.Add(new Binding("EditValue", bindingSource, "Address.Line", true, DataSourceUpdateMode.OnPropertyChanged));
     //
     MobilePhoneTextEdit.Properties.Buttons[0].BindCommand(() => ViewModel.Contacts.MobileCall(), ViewModel.Contacts);
     HomePhoneTextEdit.Properties.Buttons[0].BindCommand(() => ViewModel.Contacts.HomeCall(), ViewModel.Contacts);
     EmailTextEdit.Properties.Buttons[0].BindCommand(() => ViewModel.Contacts.MailTo(), ViewModel.Contacts);
     SkypeTextEdit.Properties.Buttons[0].BindCommand(() => ViewModel.Contacts.VideoCall(), ViewModel.Contacts);
     //
     foreach (var item in moduleDataLayout.Controls)
     {
         BaseEdit edit = item as BaseEdit;
         if (edit == null || edit.DataBindings.Count == 0)
         {
             continue;
         }
         EditorHelpers.ApplyBindingSettings <Employee>(edit, moduleDataLayout);
         edit.Properties.EditValueChanged += (s, e) => QueueViewModelUpdate();
     }
     //
     FirstNameTextEdit.EditValueChanged += (s, e) => QueueFullNameUpdate();
     LastNameTextEdit.EditValueChanged  += (s, e) => QueueFullNameUpdate();
     FullNameTextEdit.EditValueChanged  += (s, e) => QueueFullNameUpdate();
 }
Beispiel #2
0
        void BindEditors()
        {
            StatusImageComboBoxEdit.Properties.Items.AddEnum <EmployeeStatus>();
            EditorHelpers.CreatePersonPrefixImageComboBox(PrefixImageComboBoxEdit.Properties, null);
            colPriority.ColumnEdit = EditorHelpers.CreateTaskPriorityImageComboBox(null, gridControlTasks.RepositoryItems);
            DepartmentImageComboBoxEdit.Properties.Items.AddEnum <EmployeeDepartment>();
            StateImageComboBoxEdit.Properties.Items.AddEnum <StateEnum>();
            //
            ZipCodeTextEdit.DataBindings.Add(new Binding("EditValue", bindingSource, "Address.ZipCode", true, DataSourceUpdateMode.OnPropertyChanged));
            StateImageComboBoxEdit.DataBindings.Add(new Binding("EditValue", bindingSource, "Address.State", true, DataSourceUpdateMode.OnPropertyChanged));
            CityTextEdit.DataBindings.Add(new Binding("EditValue", bindingSource, "Address.City", true, DataSourceUpdateMode.OnPropertyChanged));
            AddressTextEdit.DataBindings.Add(new Binding("EditValue", bindingSource, "Address.Line", true, DataSourceUpdateMode.OnPropertyChanged));
            //
            var fluent = mvvmContext.OfType <EmployeeViewModel>();

            fluent.BindCommand(ContactButton(MobilePhoneTextEdit), x => x.Contacts.MobileCall());
            fluent.BindCommand(ContactButton(HomePhoneTextEdit), x => x.Contacts.HomeCall());
            fluent.BindCommand(ContactButton(EmailTextEdit), x => x.Contacts.MailTo());
            fluent.BindCommand(ContactButton(SkypeTextEdit), x => x.Contacts.VideoCall());
            //
            fluent.SetBinding(ribbonControl, r => r.ApplicationDocumentCaption, x => x.Title);
            fluent.SetObjectDataSourceBinding(bindingSource, x => x.Entity, x => x.Update());
            //
            foreach (Control control in moduleDataLayout.Controls)
            {
                BaseEdit edit = control as BaseEdit;
                if (edit == null || edit.DataBindings.Count == 0)
                {
                    continue;
                }
                EditorHelpers.ApplyBindingSettings <Employee>(edit, moduleDataLayout);
            }
            //
            FirstNameTextEdit.EditValueChanged += (s, e) => QueueFullNameUpdate();
            LastNameTextEdit.EditValueChanged  += (s, e) => QueueFullNameUpdate();
            FullNameTextEdit.EditValueChanged  += (s, e) => QueueFullNameUpdate();
        }