Hi, I am trying to bind data in my WPF Application using CollectionViewSource and LINQ to SQL. I have the following code in my XAML
<dbml:VendorsDataContext x:Key="vendorAddress1"/>
<CollectionViewSource x:Key="addressViewSource1" Source="{Binding
Path = tblVendor_Address ,Source={StaticResource
vendorAddress1}}"/>
Where dbml:VendorsDataContext is my dbml file. In the code behind i have written the following code:
addressViewSource.Source = bpo.GetVendorAddrTable(_vendorID);
Where GetVendorAddrTable has the following code:
var addr = from a in vendorsDC.tblVendor_Addresses
where a.vendorID == _vendorID
select new BussinessHelper.AddressContacts
{
VendorID = a.vendorID,
Address1 = a.address1,
Address2 = a.address2,
City = a.tblVendor_City.cityName,
State = a.tblVendor_State.stateName,
Country = a.tblVendor_Country.countryName,
VendorAddrID = a.vendorAddressID,
CompleteAddr = a.address1 +
a.address2 +
a.tblVendor_City.cityName +
a.tblVendor_State.stateName +
a.tblVendor_Country.countryName
};
return addr;
When i run my application there is no data being bound.
The CollectionViewSource source is null when i checked with code behind. Any ideas how to correct this?