ebakhtin 658aa3abc2 first | 6 месяцев назад | |
---|---|---|
.vs | 6 месяцев назад | |
Model | 6 месяцев назад | |
assets | 6 месяцев назад | |
bin | 6 месяцев назад | |
img | 6 месяцев назад | |
obj | 6 месяцев назад | |
App.xaml | 6 месяцев назад | |
App.xaml.cs | 6 месяцев назад | |
AssemblyInfo.cs | 6 месяцев назад | |
MainWindow.xaml | 6 месяцев назад | |
MainWindow.xaml.cs | 6 месяцев назад | |
readme.md | 6 месяцев назад | |
wpf_data_csv.csproj | 6 месяцев назад | |
wpf_data_csv.csproj.user | 6 месяцев назад | |
wpf_data_csv.sln | 6 месяцев назад |
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 = "Все компании" });
}
...