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..
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
I have created a sample project for you where I set the ViewSettings' Orientation Property. I also set the XamDataGrid's FieldLayoutSettings' LabelLocation Property to Hidden, so now there are no labels as per your requirement. Please let me know if this helps you or you have further questions on this matter.
Here is what I got after setting the property as suggested but then there are few UI issues -
1. Label/Value as first column
2. empty Column headers
3. I need to select and click only on Numeric value but if I select it, header is also selected.
Let me know if there are no attachments..
Kindly suggest.
I think that should be helpful except that how to hide first column where it shows "Label"/"Value". How to go for that..
Thanks in Advance.. :)