NoteMAUI/NoteContent/MainPage.xaml

86 lines
4.3 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="NotesDataAnalyst.MainPage">
<!-- Панель инструментов для добавления новой заметки -->
<ContentPage.ToolbarItems>
<ToolbarItem Text="Add" IconImageSource="add_icon.png" Priority="0" Order="Primary" Clicked="AddNoteButton_Clicked"/>
</ContentPage.ToolbarItems>
<!-- Контейнер контента страницы -->
<ContentPage.Content>
<StackLayout Padding="20" Spacing="15">
<!-- Панель поиска -->
<SearchBar x:Name="searchBar"
Placeholder="Поиск по заметкам"
TextChanged="OnSearchTextChanged" />
<!-- Выпадающий список категорий -->
<Picker x:Name="categoryPicker"
Title="Выберите категорию"
ItemsSource="{Binding Categories}"
SelectedIndexChanged="OnCategorySelected" />
<!-- Коллекция заметок с возможностью прокрутки и анимацией -->
<CollectionView x:Name="notesCollectionView"
ItemsSource="{Binding Notes}"
VerticalScrollBarVisibility="Always"
HeightRequest="500">
<!-- Устанавливаем высоту CollectionView -->
<!-- Настройка вертикального расположения с отступами -->
<CollectionView.ItemsLayout>
<LinearItemsLayout Orientation="Vertical" ItemSpacing="15"/>
</CollectionView.ItemsLayout>
<!-- Шаблон отображения элемента -->
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame Padding="0" Margin="5" CornerRadius="8" BackgroundColor="Transparent">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="OnNoteTapped" />
</Frame.GestureRecognizers>
<!-- Содержимое элемента (изображение и заголовок) -->
<StackLayout Orientation="Vertical"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
WidthRequest="300"
HeightRequest="150">
<!-- Изображение заметки -->
<Image Source="{Binding Image}"
Aspect="AspectFill"
HeightRequest="120"
WidthRequest="300"
HorizontalOptions="Center"
VerticalOptions="Center">
<Image.Triggers>
<DataTrigger TargetType="Image" Binding="{Binding Image}" Value="{x:Null}">
<Setter Property="Source" Value="placeholder_image.png" />
</DataTrigger>
</Image.Triggers>
</Image>
<!-- Заголовок заметки -->
<Label Text="{Binding Title}"
FontSize="18"
FontAttributes="Bold"
HorizontalOptions="Center"
VerticalOptions="End"
TextColor="Black" />
</StackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</StackLayout>
</ContentPage.Content>
</ContentPage>