public static StackElementVM Create(IStackElementParentVM parent, ObservableCollection <IStackElementVM> stackElementVMs, string name, ElementType elementType, string marginText, string text, TextSizeType textSize, Action onClick, bool isReadOnly) { StackElementVM elementVM; if (stackElementVMs != null && stackElementVMs.Count > 0) { elementVM = new StackElementVM(parent, null); elementVM.Element = new ItemElementVM(elementVM, ElementType.None); stackElementVMs.Add(elementVM); } elementVM = new StackElementVM(parent, name); if (marginText != null) { elementVM.MarginElement = new ItemElementVM(elementVM, ElementType.Label) { Text = marginText, TextSize = textSize }; } elementVM.Element = new ItemElementVM(elementVM, elementType) { Text = text, TextSize = textSize, IsReadOnly = isReadOnly }; if (onClick != null) { elementVM.Element.Command = new RelayCommand((obj) => onClick()); } return(elementVM); }
public StackElementVM(IStackElementParentVM parent, string name) { _parent = parent; Name = name; // _parent.LayoutVM.RegisterElementVM(this); }