My requirement is I want to fetch data form database and will assign to some collection in a class and I want add that as object data provider in my UserControl..that data i want to assign it to Datagrid with my customized columns ..WHICH PROPERTY CAN I USE..?
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:data="clr-namespace:FrontOffice2012.DB"
  mc:Ignorable="d" d:DesignHeight="357" d:DesignWidth="765" MinHeight="255" MinWidth="700" Loaded="UserControl_Loaded">
 
 
 
 

 
 
 
 
 
 
 

 
 
 
 

 
 
  All
  Active
  In Active
 

 

  AlternatingRowBackground="LightBlue" CanUserAddRows="False"  IsReadOnly="True" ItemsSource="{Binding Source={StaticResource objDs}}"
  AutoGenerateColumns="True" >
 
 
 
 
 
 
 
 
 

 

 
 
 
 
 
 

 
 
 
 
 
 

 

 
 
 
 
 
 

 

 
 

 

 
 
 
 
 
 
 
 

 

 


*******************************
Class for ObjectDataProvider
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FrontOffice2012.DB;

namespace FrontOffice2012.DB
{
  public class StudentDetails
  {
  private CompanyDataContext dc = new CompanyDataContext();
  private IEnumerable _StudentsCollection;

  public IEnumerable StudentsCollection
  {
  get { return _StudentsCollection; }
  set { _StudentsCollection = value; }
  }

  public IEnumerable GetStudents()
  {
  var result = (from a in dc.Students
  select
  new StudentData
  {
  PKStudentId = a.PKStudentId,
  RegistrationNumber = a.RegistrationNumber,
  StudentName = a.StudentName,
  AmountPaid = a.AmountPaid,
  AmountToBePaid = a.AmountToBePaid,
  Active = a.Active,
  RegistrationDate = a.RegistrationDate
  });
  return result;
  }

  public IEnumerable GetBatchNames()
  {
  var result = (from a in dc.Batches select new BatchName {Batchname = a.BatchName});
  return result;
  }

  public IEnumerable GetStudentDetailsByStatus(int selind)
  {
  CompanyDataContext dc = new CompanyDataContext();
  switch (selind)
  {
  case 2:
  var result1 = (from a in dc.Students
  where a.Active == false
  select new StudentData
  {
  PKStudentId = a.PKStudentId,
  RegistrationNumber = a.RegistrationNumber,
  StudentName = a.StudentName,
  AmountPaid = a.AmountPaid,
  AmountToBePaid = a.AmountToBePaid,
  Active = a.Active,
  RegistrationDate = a.RegistrationDate
  });
  return result1;
  break;
  case 1:
  var result2 = (from a in dc.Students
  where a.Active == true
  select new StudentData
  {
  PKStudentId = a.PKStudentId,
  RegistrationNumber = a.RegistrationNumber,
  StudentName = a.StudentName,
  AmountPaid = a.AmountPaid,
  AmountToBePaid = a.AmountToBePaid,
  Active = a.Active,
  RegistrationDate = a.RegistrationDate
  });
  return result2;
  break;
  default:
  return GetStudents();
  break;
  }

  }
  }

  public class StudentData
  {
  public int PKStudentId;
  public string RegistrationNumber;
  public string StudentName;
  public decimal? AmountPaid;
  public decimal? AmountToBePaid;
  public bool? Active;
  private DateTime? _RegistrationDate;

  public DateTime? RegistrationDate
  {
  get { return _RegistrationDate; }
  set { _RegistrationDate = value; }
  }
  }


  public class BatchDetailsODP
  {
  private CompanyDataContext dc = new CompanyDataContext();
  private IEnumerable _BatchNames;

  public IEnumerable Batchnames
  {
  get { return _BatchNames; }
  set { _BatchNames = value; }
  }


  }

  public class BatchName
  {
  public string Batchname;
  }
}