Skip to main content
Home Forums Silverlight Programming Visual Studio & Silverlight Development Tools SL3, RIA, and vanliia Textbox Binding?
4 replies. Latest Post by pattormey on November 7, 2009.
(0)
pattormey
Member
35 points
18 Posts
11-07-2009 3:33 PM |
New to SL...
I'm trying to use RIA DomainDataSource without using the RIA DataFrorm. I want explicit control of the UI
But when I Bind to a vanilla SL3 TextBox
I get (Below) in the Immediate Windows But it still works!
System.Windows.Data Error: BindingExpression path error: 'Name' property not found on 'System.Windows.Data.EntityCollectionView' 'System.Windows.Data.EntityCollectionView' (HashCode=48630964). BindingExpression: Path='Name' DataItem='System.Windows.Data.EntityCollectionView' (HashCode=48630964); target element is 'System.Windows.Controls.TextBox' (Name='txtName'); target property is 'Text' (type 'System.String')..
Any Idea of where I should look to Understand this
Thanks
Fredrik N
Participant
1126 points
228 Posts
11-07-2009 4:50 PM |
What kind of object will your ddsCities return (the method you specify as QueryName)? If it will return a single object with a property "Name", you shouldn't get any error. In your case it looks like it returns an EntityCollectionView.
11-07-2009 5:23 PM |
Hi Fredrik, thanks!
It's returning a POCO List..
Just full of play time data
It does work.. It's the messages in the Immediate Window that confuse me..
Any help would be appreciated
I'm followling the demo in the July 09 RIA Services DPF download.microsoft.com
[EnableClientAccess()]
public class CityService : DomainService{private CityData _cityData = new CityData();public IEnumerable<City> GetCities(){ return _cityData.Cities;}}
public class CityData{private List<City> _cities = new List<City>();public IList<City> Cities{get{LoadCities(); //loads the junk datareturn this._cities;}}}
11-07-2009 5:36 PM |
I tried your example and I didn't get the error in the im. window. Here is my example code:
<riaControls:DomainDataSource x:Name="ddsCities" QueryName="GetCities"> <riaControls:DomainDataSource.DomainContext> <dc:MyDomainContext/> </riaControls:DomainDataSource.DomainContext> </riaControls:DomainDataSource>
<StackPanel DataContext="{Binding Data, ElementName=ddsCities}"> <TextBox Text="{Binding Name}"/> </StackPanel>
[EnableClientAccess()] public class MyDomainService : DomainService { public IEnumerable<City> GetCities() { return new List<City>() { new City() { ID = 0, Name = "New York" }, new City() { ID = 1, Name = "Stockholm" } }; } }
public class City { [Key] public int ID { get; set; }
public string Name { get; set; } }
11-07-2009 7:51 PM |
Thanks! Fredrik
I'll work from your example forward.