public IEnumerable<Location> Locations
{
get { return (IEnumerable<Location>)GetValue(LocationsProperty); }
set { SetValue(LocationsProperty, value); }
}
public static readonly DependencyProperty LocationsProperty =
DependencyProperty.Register("Locations", typeof(IEnumerable<Location>), typeof(userControl), new PropertyMetadata(null));
public class Location
{
public db.Location DbLocation { get; set; }
public ObservableCollection<db.Person> DbContactsInLocation { get; set; }
}
Locations = myDataContext.Locations
.Where(l => l.Active == "Y")
.OrderBy(l => l.Name)
.Select(l => new Location {
DbLocation = l
**DbContactsInLocation = l.PersonLocations.Select(pl => pl.personLocation.person)**
}).ToList();
我越来越:
无法将类型 System.Collections.Generic.IEnumerable 隐式转换
<myDataContext.Person>'
为 'System.Collections.ObjectModel.ObservableCollection<myDataContext.Person>'
存在显式转换(您是否缺少演员表?)
有任何想法吗?