ebakhtin 658aa3abc2 first | il y a 6 mois | |
---|---|---|
.vs | il y a 6 mois | |
Model | il y a 6 mois | |
assets | il y a 6 mois | |
bin | il y a 6 mois | |
img | il y a 6 mois | |
obj | il y a 6 mois | |
App.xaml | il y a 6 mois | |
App.xaml.cs | il y a 6 mois | |
AssemblyInfo.cs | il y a 6 mois | |
MainWindow.xaml | il y a 6 mois | |
MainWindow.xaml.cs | il y a 6 mois | |
readme.md | il y a 6 mois | |
wpf_data_csv.csproj | il y a 6 mois | |
wpf_data_csv.csproj.user | il y a 6 mois | |
wpf_data_csv.sln | il y a 6 mois |
CSV:
Title,Company,Price,Category,Existence,ArrivalDate,Rating,Photo
"Redmi A3","Xiaomi",6999,"Смартфон",True,2023-12-15,3.9,""
"12","Xiaomi",44999,"Смартфон",True,2024-03-21,4.7,""
"iPhone 11 Pro","Apple",48999,"Смартфон",False,2023-09-19,4.3,""
"iPhone SE 2022","Apple",36999,"Смартфон",False,2023-10-25,4.1,""
"Galaxy S22","Samsung",61299,"Смартфон",True,2024-02-21,4.8,""
"Redmi Watch 2","Xiaomi",5299,"Смарт-Часы",True,2023-11-09,3.2,""
"ExpertBook B1","Asus",33999,"Ноутбук",True,2023-01-09,4,""
"MateBook D 15","Huawei",44999,"Ноутбук",False,2023-08-17,4.4,""
"Watch SE 2022","Apple",29499,"Смарт-Часы",True,2023-08-29,3.8,""
"R272ymix","Acer",10999,"Монитор",True,2023-11-11,4.6,""
"27B3HM","AOC",12999,"Монитор",True,2024-04-05,4.7,""
"Watch Ultra 49mm","Apple",75999,"Смарт-Часы",False,2023-05-06,4.8,""
XAML:
...
<DataGrid
Grid.Row="1"
Grid.Column="1"
CanUserAddRows="False"
AutoGenerateColumns="False"
ItemsSource="{Binding ProductList}">
<DataGrid.Columns>
<DataGridTextColumn
Header="Категория"
Binding="{Binding Category}"/>
<DataGridTextColumn
Header="Компания"
Binding="{Binding Company}"/>
<DataGridTextColumn
Header="Название"
Binding="{Binding Title}"/>
<DataGridTextColumn
Header="Цена"
Binding="{Binding Price}"/>
<DataGridTextColumn
Header="Наличие"
Binding="{Binding ExistenceString}"/>
<DataGridTextColumn
Header="Дата поступления"
Binding="{Binding ArrivalDate,StringFormat='dd.MM.yyyy'}"/>
<DataGridTextColumn
Header="Оценка"
Binding="{Binding Rating}"/>
</DataGrid.Columns>
</DataGrid>
...
C#:
...
public MainWindow()
{
InitializeComponent();
DataContext = this;
Globals.dataProvider = new CSVDataProvider();
ProductList = Globals.dataProvider.GetProducts();
ProductPrices = Globals.dataProvider.GetPrices().ToList();
CategoryList = Globals.dataProvider.GetCategories().ToList();
CategoryList.Insert(0, new ProductCategory { title = "Все категории" });
ProductCompanies = Globals.dataProvider.GetCompanies().ToList();
ProductCompanies.Insert(0, new ProductCompany { title = "Все компании" });
}
...