Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
465
XamlGrid - showing list horizontally instead of showing in number of rows
posted

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.

Parents Reply Children