I'm trying to decorate my Editors and group them with "sub-labels" in columns, but my results are not consistent.
Here is an example of my Class Model :
public class Patient
{
[SQLite.AutoIncrement, SQLite.PrimaryKey]
public int id { get; set; }
public byte[] uuid { get; set; }
[Display(GroupName = "Who")]
public string title { get; set; }
[Display(GroupName = "Who")]
public string language { get; set; }
[Display(GroupName = "Who")]
public string financial { get; set; }
[Display(GroupName = "Name")]
[DataFormDisplayOptions(RowOrder = 0)]
public string fname { get; set; }
[Display(GroupName = "Name")]
[DataFormDisplayOptions(RowOrder = 1)]
public string lname { get; set; }
[Display(GroupName = "Name")]
[DataFormDisplayOptions(RowOrder = 2) ]
public string mname { get; set; }
public DateTime DOB { get; set; }
public string street { get; set; }
public string postal_code { get; set; }
public string city { get; set; }
public string state { get; set; }
public string country_code { get; set; }
Here is the type of grouping and labeling that I'm trying to achieve at the top of this post.
![]()
Hi Frederick,
Your requirement can be achieved with the help of ColumnCount property for the DataFormGroupItem and ColumnSpan for the DataFormItem. Please refer to the following code snippet for your reference.
Code Snippet
|
private void dataForm_GenerateDataFormItem(object sender, GenerateDataFormItemEventArgs e) { if (e.DataFormGroupItem != null) { if (e.DataFormGroupItem.Name == "Who") { e.DataFormGroupItem.ColumnCount = 4; } else if (e.DataFormGroupItem.Name == "Contact") { e.DataFormGroupItem.ColumnCount = 2; } } } |
In Model Class
|
public class ContactInfo : INotifyPropertyChanged { public string Id { get; set; }
[Display(GroupName = "Who")] [DataFormDisplayOptions(ColumnSpan = 4)] public string title { get; set; }
[Display(GroupName = "Who")] public string Name { get; set; }
[Display(GroupName = "Who")] public string fname { get; set; }
[Display(GroupName = "Who")] public string mname { get; set; }
[Display(GroupName = "Who")] public string lname { get; set; }
[Display(GroupName = "Who")] [DataFormDisplayOptions(ColumnSpan = 2)] public string DOB { get; set; }
[Display(GroupName = "Who")] [DataFormDisplayOptions(ColumnSpan = 2)] public string Sex { get; set; }
[Display(GroupName = "Who")] [DataFormDisplayOptions(ColumnSpan = 2)] public string Gender { get; set; }
[Display(GroupName = "Who")] [DataFormDisplayOptions(ColumnSpan = 2)] public string orientation { get; set; }
[Display(GroupName = "Who")] [DataFormDisplayOptions(ColumnSpan = 2)] public int External { get; set; }
[Display(GroupName = "Who")] [DataFormDisplayOptions(ColumnSpan = 2)] public string SSN { get; set; }
[Display(GroupName = "Who")] [DataFormDisplayOptions(ColumnSpan = 2)] public int License { get; set; }
[Display(GroupName = "Who")] [DataFormDisplayOptions(ColumnSpan = 2)] public string MartialStatus { get; set; }
[Display(GroupName = "Who")] public string user { get; set; }
[Display(GroupName = "Who")] public string user2 { get; set; }
[Display(GroupName = "Who")] public string user3 { get; set; }
[Display(GroupName = "Who")] public string user4 { get; set; }
[Display(GroupName = "Who")] [DataFormDisplayOptions(ColumnSpan = 3)] public string Billing { get; set; }
[Display(GroupName = "Who")] [DataFormDisplayOptions(ColumnSpan = 3)] public string PreviousName { get; set; }
[Display(GroupName = "Contact")] public string street { get; set; }
[Display(GroupName = "Contact")] public string postal_code { get; set; }
[Display(GroupName = "Contact")] public string city { get; set; }
[Display(GroupName = "Contact")] public string state { get; set; }
[Display(GroupName = "Contact")] public string country { get; set; }
public event PropertyChangedEventHandler PropertyChanged; private void RaisePropertyChanged(String PropertyName) { this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(PropertyName)); } } |
Please refer to the following UG documentation for your reference.
Please refer to the demo sample in the attachment. Please let us know if you have any concerns.
Regards,
SaiGanesh Sakthivel