public void LinkToDataLayout(DataLayoutControl _dataLayout, XPCollection ds) { XPClassInfo _classInfo = ds.ObjectClassInfo; var objectBaseLine = AppListSession.FindObject <UIObjectBase>(CriteriaOperator.Parse("[ObjectName] = ? ", _classInfo.FullName)); if (objectBaseLine == null) { return; } var ControlList = GetControlList(_dataLayout, objectBaseLine); foreach (var c in ControlList) { //Get Label c.Item.Text = c.FieldSettings.ChooseValueForCurrentLang(CoreLib.MyEnums.UILabelType.FieldCaption); c.Item.OptionsToolTip.ToolTip = c.FieldSettings.ChooseValueForCurrentLang(CoreLib.MyEnums.UILabelType.FieldHelp); c.Item.Control.Enabled = !c.FieldSettings.IsDisabled; if (c.FieldSettings.LookupEditor != null) { if (c.Item.Control is LookUpEdit) { LinkListToColumn((LookUpEdit)c.Item.Control, c.FieldSettings.LookupEditor.ObjectType()); } else if (c.Item.Control is SearchLookUpEdit) { LinkListToColumn((SearchLookUpEdit)c.Item.Control, c.FieldSettings.LookupEditor.ObjectType()); } } } }
private List <LayoutItemInfo> GetControlList(DataLayoutControl _dataLayout, UIObjectBase _objectBaseLine) { var lst = new List <LayoutItemInfo>(); string cName = ""; foreach (var item in _dataLayout.Items) { LayoutControlItem i = item as LayoutControlItem; if (i != null) { var c = i.Control; cName = $"{c.Name.Replace(c.GetType().Name, "")}"; UILabel label = _objectBaseLine.ObjectLabels.Where(x => x.ColumnName == cName).FirstOrDefault(); if (label == null) { continue; } lst.Add(new LayoutItemInfo() { FieldName = cName.Trim(), Item = i, FieldSettings = label }); } } return(lst); }
protected bool disposedValue = false; // To detect redundant calls protected override void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { //only if disposing is called from Dispose pattern CurrentChanged -= handleCurrentChanged; //disconnect events in any case if (_cnt != null) { _cnt.FieldRetrieved -= FieldRetrievedHandler; _cnt.FieldRetrieving -= FieldRetrievingHandler; _cnt = null; } resetAttributes(); if (DataSource != null) { DataSource = null; } } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; //call inherited base.Dispose(disposing); } }
public void RetrieveFields(DataLayoutControl lc) { lc.Clear(); LayoutElementsBindingInfoHelper bindingHelper = new LayoutElementsBindingInfoHelper(lc); LayoutElementsBindingInfo info; info = bindingHelper.CreateDataLayoutElementsBindingInfo(); bindingHelper.FillWithSuggestedValues(info); List <LayoutElementBindingInfo> bindingsInfo = info.GetAllBindings(); foreach (LayoutElementBindingInfo bindingInfo in bindingsInfo) { if (bindingInfo.DataInfo.Name == "Description") { bindingInfo.EditorType = typeof(MemoEdit); break; } } LayoutCreator creator = new LayoutCreator(lc); creator.CreateLayout(info); foreach (BaseLayoutItem item in lc.Items) { if (item is LayoutControlItem) { Control c = (item as LayoutControlItem).Control; if (c.DataBindings[0].BindingMemberInfo.BindingMember == "Description") { (item as LayoutControlItem).SizeConstraintsType = SizeConstraintsType.Custom; (item as LayoutControlItem).MinSize = new Size(0, 100); } } } }
public ValueSelectorControl(ScatterChartConstantLineUserData data) { DataLayoutControl dataLayoutControl = new DataLayoutControl(); BindingSource source = new BindingSource(); ConstantLineModuleData = data ?? new ScatterChartConstantLineUserData(); source.DataSource = ConstantLineModuleData; dataLayoutControl.DataSource = source; dataLayoutControl.RetrieveFields(); dataLayoutControl.Dock = DockStyle.Fill; Controls.Add(dataLayoutControl); Dock = DockStyle.Top; }
private void MakeNewLayoutControl() { // remove old if (!ReferenceEquals(null, _cnt)) { _contentContainer.Controls.Remove(_cnt); } DataLayoutControl dl = new DataLayoutControl(); _contentContainer.Controls.Add(dl); dl.Dock = DockStyle.Fill; dl.AllowGeneratingNestedGroups = DevExpress.Utils.DefaultBoolean.True; dl.AllowGeneratingCollectionProperties = DevExpress.Utils.DefaultBoolean.False; dl.AutoRetrieveFields = true; dl.AllowCustomization = true; dl.OptionsCustomizationForm.EnableUndoManager = true; dl.OptionsCustomizationForm.ShowPropertyGrid = true; dl.OptionsCustomizationForm.ShowRedoButton = true; //dl.OptionsCustomizationForm.ShowUndoButton = true; dl.OptionsItemText.TextAlignMode = DevExpress.XtraLayout.TextAlignMode.CustomSize; this.DataLayout = dl; }
private static void AutoValidationPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { control = (DataLayoutControl)source; control.IsVisibleChanged += Control_IsVisibleChanged; var a = control.GetBindingExpression(DataLayoutControl.CurrentItemProperty); }