using System.Windows; using WpfApp2.model; namespace WpfApp2 { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { public IEnumerable ProductList { get; set; } public MainWindow() { InitializeComponent(); DataContext = this; Globals.dataProvider = new LocalDataProvider(); ProductList = Globals.dataProvider.getPerson(); } private void ExitButton_Click(object sender, RoutedEventArgs e) { Application.Current.Shutdown(); } } interface IDataProvider { IEnumerable getPerson(); } public class LocalDataProvider : IDataProvider { public IEnumerable getPerson() { return new Product[]{ new Product{ name="Микрофон", model="NEUMANN TLM 102"}, new Product{ name="Мониторы", model="SoundStation A-6"}, new Product{ name="Звуковая карта", model="Focusrite Solo"}, }; } } }