Hello,
I adapted your virtual data loading sample to my own silverlight WCF RIA Services project.
I'm using version 2010.3.1110.1040.
I'm geting binding expressions:
Etc for all the properties of my object.
My grid is:
My viewmodel is:
And the loading happens here:
It looks like there is a dynamic class generated as a proxy for me...
I tought I'm doing exactly the same then in the sample, but obviously not...
Thank you for your help...
John.
I adapted your virtual data loading sample to my own silverlight WCF RIA Services project.
I'm using version 2010.3.1110.1040.
I'm geting binding expressions:
Erreur System.Windows.Data : erreur de chemin d
'accès BindingExpression : propriété '
Nom
' introuvable sur '
{}
' '
DynamicClass1
' (HashCode=0). BindingExpression : Path='
Nom
' DataItem='
{}
' (HashCode=0); l'
élément cible est
'Telerik.Windows.Controls.GridView.GridViewCell'
(Name=
''
); la propriété cible est
'Value'
(type
'System.Object'
)...
Etc for all the properties of my object.
My grid is:
<
telerik:RadGridView
x:Name
=
"grdCustomerList"
ItemsSource
=
"{Binding Customers}"
AutoGenerateColumns
=
"False"
ShowGroupPanel
=
"False"
IsFilteringAllowed
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"ID"
DataMemberBinding
=
"{Binding CliID}"
/>
<
telerik:GridViewDataColumn
Header
=
"Civ"
DataMemberBinding
=
"{Binding Civ}"
/>
<
telerik:GridViewDataColumn
Header
=
"Structure"
DataMemberBinding
=
"{Binding Structure}"
/>
<
telerik:GridViewDataColumn
Header
=
"Nom"
DataMemberBinding
=
"{Binding Nom}"
/>
<
telerik:GridViewDataColumn
Header
=
"Prénom"
DataMemberBinding
=
"{Binding Prenom}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
My viewmodel is:
using
System;
using
System.Net;
using
System.Windows;
using
System.Windows.Controls;
using
System.Windows.Documents;
using
System.Windows.Ink;
using
System.Windows.Input;
using
System.Windows.Media;
using
System.Windows.Media.Animation;
using
System.Windows.Shapes;
using
Telerik.Windows.Data;
using
Telerik.Windows.Controls;
using
System.ServiceModel.DomainServices.Client;
using
Ogaca.Web;
namespace
Project
{
public
class
VirtualClientDatacontext : ViewModelBase
{
OgContext _Context;
public
OgContext Context
{
get
{
if
(_Context ==
null
)
{
_Context =
new
OgContext();
}
return
_Context;
}
}
VirtualQueryableCollectionView _Customers;
public
VirtualQueryableCollectionView Customers
{
get
{
if
(_Customers ==
null
)
{
_Customers =
new
VirtualQueryableCollectionView();
_Customers.VirtualItemCount = 100;
// Force ItemsLoading to get the real total item count and data in a single request
_Customers.LoadSize = 10;
_Customers.ItemsLoading += Customers_ItemsLoading;
}
return
_Customers;
}
private
set
{
if
(
this
._Customers != value)
{
_Customers.ItemsLoading -= Customers_ItemsLoading;
this
._Customers = value;
this
.OnPropertyChanged(
"Customers"
);
}
}
}
void
Customers_ItemsLoading(
object
sender, VirtualQueryableCollectionViewItemsLoadingEventArgs e)
{
EntityQuery<Client> query = Context.GetClientsQuery();
query.IncludeTotalCount =
true
;
Context.Load<Client>(EntityQueryExtensions.Sort<Client>(query, Customers.SortDescriptors).Skip(e.StartIndex).Take(e.ItemCount),
LoadBehavior.RefreshCurrent, CustomersLoaded, e.StartIndex);
}
private
void
CustomersLoaded(LoadOperation lo)
{
if
(lo.TotalEntityCount != Customers.VirtualItemCount)
{
Customers.VirtualItemCount = lo.TotalEntityCount;
}
Customers.Load((
int
)lo.UserState, lo.Entities);
}
public
void
ClearLoadedCustomers()
{
this
.Customers =
null
;
}
}
}
And the loading happens here:
public
MainPage()
{
InitializeComponent();
MainPageObject =
this
;
this
.loginContainer.Child =
new
LoginStatus();
App.Current.Host.Content.FullScreenChanged +=
new
EventHandler(Content_FullScreenChanged);
DataContext =
new
VirtualClientDatacontext();
}
It looks like there is a dynamic class generated as a proxy for me...
I tought I'm doing exactly the same then in the sample, but obviously not...
Thank you for your help...
John.