Exemple #1
0
        public static void ApplyLabel(MyGridView gv, XPCollectionExt ds)
        {
            if (gv.UnitOfWorkXpo == null)
            {
                string errTxt = $"GridView has null UnitOfWorkXpo please set data source for this gridView{gv.GridControl.TopLevelControl.Name}.{gv.GridControl.Name}.{gv.Name}";
                if (gv.GridControl.TopLevelControl is MyForm)
                {
                    var frm = (CoreLib.MyForm)gv.GridControl.TopLevelControl;
                    if (frm.IsMdiContainer)
                    {
                        frm.SetStatusBarText(errTxt);
                    }
                    else
                    {
                        XtraMessageBox.Show(errTxt);
                    }
                }
                return;
            }

            var classInfo      = ds.ObjectClassInfo;
            var objectBaseLine = gv.UnitOfWorkXpo.FindObject <UIObjectBase>(CriteriaOperator.Parse("[ObjectName] = ? ", classInfo.FullName));

            if (objectBaseLine == null)
            {
                return;
            }
            foreach (var m in classInfo.Members /*.Where(x => !string.IsNullOrEmpty(x.MappingField) || x.FindAttributeInfo("NonPersistent") != null)*/)
            {
                // bool isNonPersist = m.FindAttributeInfo("NonPersistentAttribute") != null;

                var c = gv.Columns.ColumnByFieldName(m.Name);
                if (c != null)
                {
                    string fieldName = $"{m.Owner.FullName}.{m.Name}";
                    var    labelLine = objectBaseLine.FindOrCreateUILabel(fieldName);
                    if (labelLine != null)
                    {
                        labelLine.ApplyFieldSettings(gv, c);
                    }
                }
            }
        }
Exemple #2
0
 public ViewDetailsEventArgs(GridColumnInfo _gridColumnInfo, MyGridView _callerGrid)
 {
     fGridColumnInfo = _gridColumnInfo;
     CallerGrid      = _callerGrid;
 }