## Каркас приложения. Модель данных. Привязка данных. Табличный вывод.
`class1`
```
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WpfApp2.model
{
public class Product
{
public string model { get; set; }
public string name { get; set; }
public string photo { 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`
```
```
`Mainwindow.xaml.cs`
```
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"},
};
}
}
}
```
Результат
![](/assets/1.png)