Hello,
I’ve started my RadControl a few days ago and I’am delighted by the number feature and mature design of the components.
However I've also just started with WPF UI Development, so my learning curve is still steep and maybe you can help me with a Data Binding problem/misunderstanding of mine:
I've got a RadGridView (inside a Data Template) in an MVVM Application, and I’m trying to bind an Observable Collection to a GridViewData Column. Please take a look at my following Models and View-Models (I’ve stripped out unnecessary code):
I want to put these Collections in one RadGridView (as you can see, I just want the Values member from the CalendarWeek in the Column).
I have tried many approaches I have stumbled across the RadControl Help, Forums or on StackOverflow, but none seems too work (or I missed the right combination) for me.
What are your preferred approach here?
Hierarchical? Master Detail Binding? Creating my own GridViewDataColumn Template/Style?
Thanks a lot and happy Holidays for all of you :)
Julien
I’ve started my RadControl a few days ago and I’am delighted by the number feature and mature design of the components.
However I've also just started with WPF UI Development, so my learning curve is still steep and maybe you can help me with a Data Binding problem/misunderstanding of mine:
I've got a RadGridView (inside a Data Template) in an MVVM Application, and I’m trying to bind an Observable Collection to a GridViewData Column. Please take a look at my following Models and View-Models (I’ve stripped out unnecessary code):
//Part of the ViewModel - Begin
private
ObservableCollection<ProductCategoryModel> _planCollection =
null
;
public
ViewModel()
{
//ViewModel Constructor
_planCollection =
new
ObservableCollection<ProductCategoryModel>
{
new
ProductCategoryModel(
"AlphaPlan"
),
new
ProductCategoryModel(
"BetaPlan"
)
}
}
public
ObservableCollection<ProductCategoryModel> PlanCollection
{
get
{
return
_planCollection; }
set
{ _planCollection = value; }
}
public
ObservableCollection<CalendarWeek> AlphaPlan
{
get
{
return
_planCollection[0].Numbers; }
set
{
throw
new
NotImplementedException(); }
}
public
ObservableCollection<CalendarWeek> BetaPlan
{
get
{
return
_planCollection[1].Numbers; }
set
{
throw
new
NotImplementedException(); }
}
//Part of the ViewModel - End
//The Models - Begin
public
class
CalendarWeek : INotifyPropertyChanged
{
public
CalendarWeek(
int
week,
float
value)
{
this
.Week = week;
this
.Value = value;
}
[Display(AutoGenerateField =
false
)]
public
int
Week {
get
;
set
; }
[DisplayAttribute(Name =
"Value"
)]
public
double
Value {
get
;
set
; }
}
public
class
ProductCategoryModel
{
public
ProductCategoryModel(
string
leName)
{
this
.Product = leName;
this
.Numbers =
new
ObservableCollection<CalendarWeek>();
for
(
int
i = 1; i <= 52; i++)
{
Random r =
new
Random(Guid.NewGuid().GetHashCode());
int
rInt = r.Next(0, 100);
this
.Numbers.Add(
new
CalendarWeek(i, rInt));
}
}
public
ObservableCollection<CalendarWeek> Numbers {
get
;
set
; }
public
string
Product {
get
;
set
; }
}
//The Models - End
I want to put these Collections in one RadGridView (as you can see, I just want the Values member from the CalendarWeek in the Column).
I have tried many approaches I have stumbled across the RadControl Help, Forums or on StackOverflow, but none seems too work (or I missed the right combination) for me.
What are your preferred approach here?
Hierarchical? Master Detail Binding? Creating my own GridViewDataColumn Template/Style?
Thanks a lot and happy Holidays for all of you :)
Julien