You need to make the ObservableCollection available via a Public Property on xaml1. Then in xaml2 you need a reference to xaml1, you can do this by passing an instance of xaml1 in the constructor of xaml2. Then you can bind the DataGrid to the Collection. Here is a simple example( I used WPF but the methodology is the same for Silverlight)
public partial class MainWindow: Window
{
private ObservableCollection<Person> people;
public ObservableCollection<Person> People
{
get
{
return people;
}
}
public MainWindow()
{
InitializeComponent();
people = new ObservableCollection<Person>() {new Person("a"), new Person("b"), new Person("c"), new Person("d"), new Person("e") };
}
private void buttonClick(object sender, RoutedEventArgs e)
{
Window1 w1 = new Window1(this);
w1.Show();
}
}
public class Person
{
public string Name { get; set; }
public Person(string name)
{
this.Name = name;
}
}
and this is how to bind in the second window
public partial class Window1 : Window
{
public Window1(MainWindow mw)
{
InitializeComponent();
dataGrid1.DataContext = mw.People;
dataGrid1.DisplayMemberPath = "Name";
}
}
Hope this helps