## Class1 ``` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WpfApp2.model { public class Spares { public string name { get; set; } public int price { get; set; } public string category { get; set; } public string photo { get; set; } } class Saler { public string name { get; set; } public int age { get; set; } } } ``` ## Class2 ``` using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WpfApp2.model { class Globals { public static IDataProvider dataProvider; } } ``` ## Mainwindow.xaml.cs ``` using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using WpfApp2.model; namespace WpfApp2 { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { public IEnumerable PlaceList { get; set; } public MainWindow() { InitializeComponent(); DataContext = this; Globals.dataProvider = new LocalDataProvider(); PlaceList = Globals.dataProvider.getPlace(); } private void ExitButton_Click(object sender, RoutedEventArgs e) { Application.Current.Shutdown(); } } interface IDataProvider { IEnumerable getPlace(); } public class LocalDataProvider : IDataProvider { public IEnumerable getPlace() { return new Spares[]{ new Spares{ price=55000, category="Запчасти", name="Кожух двигла"}, new Spares{ price=500, category="Авто химия", name="Средство для пластика"}, new Spares{ price=200000, category="Запчасти", name="Двигло V16"}, }; } } } ``` ## Mainwindow.xaml ```