I am trying to simply bind to a class in the codebehind and am getting a BindingExpression Error
It works fine if I try add the itemsource from code behind as so
ReportGrid.ItemsSource = SampleDataPeople;
But when I add via Binding I get this and no
Error: BindingExpression path error: 'SampleDataPeople' property not found on
'GridApp.Data.SampleDataItem, GridApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
BindingExpression: Path='SampleDataPeople' DataItem='GridApp.Data.SampleDataItem, GridApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'; target element is 'Telerik.UI.Xaml.Controls.Grid.RadDataGrid' (Name='ReportGrid'); target property is 'ItemsSource' (type 'Object')
'GridApp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\system32\WinMetadata\Windows.Devices.winmd'
<telerikGrid:RadDataGrid x:Name="ReportGrid" ItemsSource="{Binding SampleDataPeople }" AutoGenerateColumns="False" > <telerikGrid:RadDataGrid.Columns > <telerikGrid:DataGridTextColumn PropertyName="FirstName" Header="FirstName"/> <telerikGrid:DataGridTextColumn PropertyName="LastName" Header="LastName"/> </telerikGrid:RadDataGrid.Columns> </telerikGrid:RadDataGrid>
public ObservableCollection<SampleDataPerson> sampleDataPeople; public ObservableCollection<SampleDataPerson> SampleDataPeople { get { return sampleDataPeople; } set { sampleDataPeople = value; RaisePropertyChanged("SampleDataPeople"); } }
8 Answers, 1 is accepted
Thank you for contacting us.
I have prepared a working project using the given code snippets. Please, find the attached file.
Can you please clarify if this is working on your side too and if yes - can you modify it in order to reproduce the described issue?
I am looking forward to your reply.
Kind regards,
Ivaylo Gergov
the Telerik team
Ed,
I want to say that once I put my code all back in it once again stoped working.
it looks like I am using an await method so wondering if that is the reason?
namespace GridApp.Controls{ public partial class CtlReport : UserControl { CtrlReportViewModel vm; public CtlReport() { this.InitializeComponent(); vm = new CtrlReportViewModel(); this.ReportGrid.DataContext = vm;// this loads grid vm.LoadDataNoAsync();// this does not// vm.LoadData(); } }}using System;using System.Collections.Generic;using System.Collections.ObjectModel;using System.ComponentModel;using System.Linq;using System.Text;using System.Threading.Tasks;namespace GridApp.Controls{ class CtrlReportViewModel : INotifyPropertyChanged { public void LoadDataNoAsync() { ServiceReference.RemoteHostServiceClient client = new ServiceReference.RemoteHostServiceClient(); var favorites = client.UserFavoriteGetAsync(Globals.Id, "widget"); ReportData = new ObservableCollection<ReportsDataItem>(); foreach (var f in favorites.Result) { var userWidget = client.UserWidgetByIdGetAsync(f.ObjectID); ReportData.Add(new ReportsDataItem() { Description = userWidget.Result.Description, Id = userWidget.Result.Id, }); RaisePropertyChanged("ReportData"); System.Diagnostics.Debug.WriteLine("Owner {0}, Description {1}", userWidget.Result.Id, userWidget.Result.Description); } } public async void LoadData() { ServiceReference.RemoteHostServiceClient client = new ServiceReference.RemoteHostServiceClient(); var favorites = (await client.UserFavoriteGetAsync(Globals.Id, "widget")).ToList(); ReportData = new ObservableCollection<ReportsDataItem>(); foreach (var f in favorites) { var userWidget = (await client.UserWidgetByIdGetAsync(f.ObjectID)); ReportData.Add(new ReportsDataItem() { Description = userWidget.Description, Id = userWidget.Id, }); RaisePropertyChanged("ReportData"); System.Diagnostics.Debug.WriteLine("Owner {0}, Description {1}", userWidget.Id, userWidget.Description); } } public event PropertyChangedEventHandler PropertyChanged; private ObservableCollection<ReportsDataItem> reportData; public ObservableCollection<ReportsDataItem> ReportData { get { return reportData; } set { reportData = value; RaisePropertyChanged("ReportData"); } } private void RaisePropertyChanged(string name) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(name)); } } } }
<UserControl
x:Class="GridApp.Controls.CtlReport"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:GridApp.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:telerikGrid="using:Telerik.UI.Xaml.Controls.Grid"
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"
x:Name="reportctl">
<StackPanel>
<telerikGrid:RadDataGrid x:Name="ReportGrid"
ItemsSource="{Binding ReportData}"
AutoGenerateColumns="False">
<telerikGrid:RadDataGrid.Columns >
<telerikGrid:DataGridTextColumn PropertyName="Description" Header="Description"/>
<telerikGrid:DataGridTextColumn PropertyName="Id" Header="Owner"/>
</telerikGrid:RadDataGrid.Columns>
</telerikGrid:RadDataGrid>
</StackPanel>
</UserControl>
Thank you for getting back to us.
I tried to reproduce this issue but with no result. It seems that our RadDataGrid works fine with async methods. Today we uploaded a new internal build that fixes several issues in RadDataGrid. Could you please give the latest bits a try and in case you still experience issues I will need a runnable demo project that reproduces the problem so that I can debug it locally and isolate its cause.
I am looking forward to your reply.
All the best,
Ivaylo Gergov
the Telerik team
Is there a link to the new build?
The download link still has
RadControlsForWindows8Setup_2013_1_219
In order to have access to internal builds you first have to purchase or download a trial version of our latest official release. Then you can see the internal builds from your account - Manage Products -> Latest Internal Builds.
I hope this information helps.
Regards,
Ivaylo Gergov
the Telerik team
Download the Windows 8 RAD Controls (2013_1_219)
Went to Managed Products > Latest internal builds
I see do not see any new builds only
!No internal builds for your products have been uploaded recently.
Has there been any updates past 2013_1_219?
Thank you for contacting us.
Could you please provide the e-mail address with which you log into our system as I do not see active licenses or trials under the account of www@gencode.com.
Looking forward to hearing from you.
Greetings,
Apo
the Telerik team