I have a List of data with 2 properties and need to show the data horizontally instead of vertically e.g. if there are 5 rows then instead of showing 5 records, it should show 1 record with 5 columns. I need to set the text of “Label” property as the column header and “Value” as the actual value.
public class DataItem { public string Label { get; set; } public double Value { get; set; } }
public class Data : ObservableCollection { public Data() { Add(new DataItem { Label = "Idle", Value = 5}); Add(new DataItem { Label = "Failed", Value = 6 }); Add(new DataItem { Label = "Executing", Value = 3 }); Add(new DataItem { Label = "Pending", Value = 7 }); Add(new DataItem { Label = "Others", Value = 1 }); } }
In above data, grid should be something like -
Idle Failed Executing Pending Others
5 6 3 7 1
Any Inputs would be appreciable. I was trying to template "LabelPresenter" but didn't get thru.
Hello,
Thank you for your post. I have been looking into it and I can suggest you set the XamDataGrid’s ViewSettings’ Orientation Property to Horizontal in order to achieve the functionality you want. Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.
Do I need to use ViewSettings="" or something else..