This question is locked. New answers and comments are not allowed.
Hi,
I tried to find an example on when is necessary to apply some column formating to a Radgridview and the itemsource is a dynamic collection.
Basically I have a gridview defined:
The ItemSource declaration is:
Building the structure for the Dynamic Object:
Filling the List with data:
So far so god on loading that data into the grid (I might be missing some defintions on the sample).
Now, my problem is how can I format Property1 Column as currency, Property2 Column as Percent, Date Column as Date.
I really appreciate any help, and sorry if my example is a bit confusing.
Thank you
I tried to find an example on when is necessary to apply some column formating to a Radgridview and the itemsource is a dynamic collection.
Basically I have a gridview defined:
<telerik:RadGridView x:Name="PreviewGridCombined" GroupRenderMode="Flat"Margin="{StaticResource DefaultDetailGridMargin}" RowIndicatorVisibility="Collapsed"CanUserFreezeColumns="False" ItemsSource="{Binding PreviewList}"telerikStyles:StyleManager.Theme="Office Black"/>The ItemSource declaration is:
private ObservableCollection<ExpandoObject> _previewList = new ObservableCollection<ExpandoObject>();public ObservableCollection<ExpandoObject> PreviewList{ get { return _previewList; } set { _previewList = value; NotifyPropertyChanged(() => PreviewList); }}Building the structure for the Dynamic Object:
public ExpandoObject GetPreviewItem(){ var previewItem = new ExpandoObject(); ((IDictionary<string, object>)previewItem).Add("Date", null); foreach (var Item in ColumnItemList) { ((IDictionary<string, object>)previewItem).Add(Item.PropertyName1, null); ((IDictionary<string, object>)previewItem).Add(Item.PropertyName2, null); ((IDictionary<string, object>)previewItem).Add(Item.PropertyNameN, null); } return previewItem;}Filling the List with data:
public ObservableCollection<ExpandoObject> GeneratePreviewList(){ var previewList = new ObservableCollection<ExpandoObject>(); foreach (var item in DataItems) { dynamic previewItem = GetPreviewItem(); ((IDictionary<string, object>)previewItem)["Date"] = item.Date; ((IDictionary<string, object>)previewItem)["Property1"] = item.Property1Value; ((IDictionary<string, object>)previewItem)["Property2"] = item.Property2Value; ((IDictionary<string, object>)previewItem)["PropertyN"] = item.PropertyNValue; previewList.Add(previewItem); } return previewList; }So far so god on loading that data into the grid (I might be missing some defintions on the sample).
Now, my problem is how can I format Property1 Column as currency, Property2 Column as Percent, Date Column as Date.
I really appreciate any help, and sorry if my example is a bit confusing.
Thank you