generated from admin/template
verstka
This commit is contained in:
@@ -3,30 +3,33 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:models="clr-namespace:demo.Models"
|
xmlns:models="clr-namespace:demo.Models"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="500"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="600"
|
||||||
x:Class="demo.Views.MainWindow"
|
x:Class="demo.Views.MainWindow"
|
||||||
Title="Каталог товаров">
|
Title="Каталог товаров">
|
||||||
|
|
||||||
<Grid RowDefinitions="Auto, *" Margin="20">
|
<Grid RowDefinitions="Auto, *" Margin="20">
|
||||||
|
|
||||||
<!-- Топ-бар: Поиск, Сортировка, Фильтрация -->
|
<!-- Топ-бар -->
|
||||||
<Grid Grid.Row="0" ColumnDefinitions="*, Auto, Auto" ColumnSpacing="10" Margin="0,0,0,20">
|
<Grid Grid.Row="0" ColumnDefinitions="*, Auto, Auto" ColumnSpacing="10" Margin="0,0,0,20">
|
||||||
<TextBox Grid.Column="0" PlaceholderText="Введите для поиска" HorizontalAlignment="Stretch" />
|
<TextBox Grid.Column="0" PlaceholderText="Введите для поиска" />
|
||||||
<ComboBox Grid.Column="1" PlaceholderText="Сортировка" MinWidth="120" HorizontalAlignment="Stretch" />
|
<ComboBox Grid.Column="1" PlaceholderText="Сортировка" MinWidth="120" HorizontalAlignment="Stretch" />
|
||||||
<ComboBox Grid.Column="2" PlaceholderText="Фильтрация" MinWidth="120" HorizontalAlignment="Stretch" />
|
<ComboBox Grid.Column="2" PlaceholderText="Фильтрация" MinWidth="120" HorizontalAlignment="Stretch" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Список товаров из базы данных -->
|
<!-- Список товаров -->
|
||||||
<ListBox Grid.Row="1" x:Name="ProductList">
|
<ListBox Grid.Row="1" x:Name="ProductList">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate DataType="{x:Type models:IdProduct}">
|
<DataTemplate DataType="{x:Type models:IdProduct}">
|
||||||
<Grid ColumnDefinitions="Auto, *" Margin="8">
|
<Grid ColumnDefinitions="Auto, *" Margin="8">
|
||||||
<Border Grid.Column="0" Width="80" Height="80" Background="#E0E0E0" CornerRadius="4">
|
<!-- Заглушка фото -->
|
||||||
|
<Border Grid.Column="0" Width="80" Height="80" CornerRadius="4" Background="#E0E0E0">
|
||||||
<TextBlock Text="Фото" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
<TextBlock Text="Фото" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
</Border>
|
</Border>
|
||||||
<StackPanel Grid.Column="1" Margin="12,0,0,0" VerticalAlignment="Center" Spacing="4">
|
|
||||||
<!-- Выводит текстовое представление объекта товара -->
|
<!-- Информация о товаре -->
|
||||||
<TextBlock Text="{Binding}" FontWeight="SemiBold" FontSize="16" />
|
<StackPanel Grid.Column="1" Margin="12,0,0,0" Spacing="4">
|
||||||
|
<!-- Вывод того единственного свойства, которое есть в модели -->
|
||||||
|
<TextBlock Text="{Binding IdProductArticleNameIdUnitPriceIdSupplierIdManufactur}" FontWeight="SemiBold" FontSize="14" TextWrapping="Wrap" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using demo.Models;
|
using demo.Models;
|
||||||
|
|
||||||
@@ -17,10 +16,10 @@ namespace demo.Views
|
|||||||
{
|
{
|
||||||
using var context = new PostgresContext();
|
using var context = new PostgresContext();
|
||||||
|
|
||||||
// Загружаем список товаров из PostgreSQL через EF Core
|
// Загружаем список товаров из базы данных
|
||||||
var products = context.IdProducts.ToList();
|
var products = context.IdProducts.ToList();
|
||||||
|
|
||||||
// Передаем данные в элемент ListBox на форме
|
// Передаем данные в ListBox
|
||||||
ProductList.ItemsSource = products;
|
ProductList.ItemsSource = products;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user