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>'
明示的な変換が存在します (キャストがありませんか?)
何か案は?