private void GenerateTabbedLayout(IModelDetailView detailViewInfo) { if (detailViewInfo.Layout["Main"] != null) { detailViewInfo.Layout["Main"].Remove(); } IModelLayoutGroup main = detailViewInfo.Layout.AddNode <IModelLayoutGroup>(ModelDetailViewLayoutNodesGenerator.MainLayoutGroupName); IModelLayoutGroup generalNode = null; IModelTabbedGroup tabNode = null; IModelLayoutGroup footerNode = null; foreach (IModelViewItem modelViewItem in detailViewInfo.Items) { IModelPropertyEditor editor = modelViewItem as IModelPropertyEditor; if (editor != null) { if (FindModelDefaultAttribute(editor.ModelMember.MemberInfo, CustomDetailViewItemsGenarator.VisiblePropertiesAttribute) != null) { editor.PropertyEditorType = typeof(DetailPropertyEditor);// editor.ModelMember.EditorsInfo[EditorAliases.DetailPropertyEditor].DefaultEditor; } editor.ImmediatePostData = true; IModelMemberExtender item = (IModelMemberExtender)editor; string tabPageName = item.TabPageName; if (string.IsNullOrEmpty(tabPageName)) { if (item.Footer) { if (footerNode == null) { footerNode = main.AddNode <IModelLayoutGroup>(CustomDetailViewItemsGenarator.FooterId); footerNode.Index = 5; } AddLayoutItemNode(footerNode, editor); } else { if (generalNode == null) { generalNode = main.AddNode <IModelLayoutGroup>(CustomDetailViewItemsGenarator.GeneralId); generalNode.Index = editor.Index.HasValue ? editor.Index : 0; } AddLayoutItemNode(generalNode, editor); } } else { if (tabNode == null) { tabNode = main.AddNode <IModelTabbedGroup>(CustomDetailViewItemsGenarator.MainTabId); tabNode.Index = editor.Index.HasValue ? editor.Index : 1; } IModelLayoutGroup group = AddEditorToTabbedGroup(tabNode, tabPageName, editor); if (editor.ModelMember.Index >= 0) { group.Index = editor.ModelMember.Index; } } } } }
private void AddLayoutItemNode(IModelLayoutGroup layoutGroup, IModelPropertyEditor editor) { ModelDefaultAttribute modelDefaultAttribute = FindModelDefaultAttribute(editor.ModelMember.MemberInfo, CustomDetailViewItemsGenarator.ActionsContainerAttribute); if (modelDefaultAttribute != null) { IModelViewItem container = editor.Parent.GetNode(modelDefaultAttribute.PropertyValue) as IModelViewItem; if ((container != null)) { IModelLayoutViewItem item = layoutGroup.AddNode <IModelLayoutViewItem>(container.Id); item.ViewItem = container; item.Index = editor.Index; } } else { IModelLayoutViewItem item = layoutGroup.AddNode <IModelLayoutViewItem>(editor.PropertyName); item.ViewItem = editor; item.Index = editor.Index; } }
internal static List <IModelLayoutViewItem> AddItems(this IModelLayoutGroup group, object properties) { var list = new List <IModelLayoutViewItem>(); var pts = properties.GetType().GetProperties(); foreach (var item in pts) { var i = group.AddNode <IModelLayoutViewItem>(); list.Add(i); } return(list); }
public override void UpdateNode(DevExpress.ExpressApp.Model.Core.ModelNode node) { IModelViewLayout layoutNode = (IModelViewLayout)node; IModelLayoutGroup mainGroup = layoutNode.GetNode(ModelDetailViewLayoutNodesGenerator.MainLayoutGroupName) as IModelLayoutGroup; mainGroup.Direction = FlowDirection.Horizontal; IModelLayoutViewItem myItem = mainGroup.AddNode <IModelLayoutViewItem>("Icon"); myItem.Index = int.MinValue; myItem.MaxSize = new System.Drawing.Size(64, 64); myItem.SizeConstraintsType = XafSizeConstraintsType.Custom; myItem.ViewItem = ((IModelCompositeView)layoutNode.Parent).Items.GetNode("Icon") as IModelViewItem; }
protected IModelLayoutGroup HGroup <T>(IModelDetailView view, IModelLayoutGroup layout, int index, Expression <Func <T, object> >[] property) { try { //layout.GetNodes<IModelLayoutViewItem>(); var gname = "R" + (layout.Count() + 1); //var ng = (layout.GetNode(gname)); //if (ng != null) //{ //} var group = layout.AddNode <IModelLayoutGroup>(gname); group.Index = index; group.Direction = FlowDirection.Horizontal; var lastIndex = group.NodeCount; foreach (var item in property) { var rst = group.AddNode <IModelLayoutViewItem>("I" + lastIndex); if (item != null) { var name = GetMemberName(item); rst.ViewItem = view.Items[name]; } lastIndex++; rst.Index = lastIndex; } return(group); } catch (Exception ex) { throw ex; } }