presence/Presence.Desktop/Views/MainWindow.axaml
2024-12-12 11:32:15 +03:00

64 lines
3.0 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.

<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:Presence.Desktop.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Presence.Desktop.Views.MainWindow"
Icon="/Assets/avalonia-logo.ico"
Title="Presence.Desktop"
x:DataType="vm:MainWindowViewModel">
<DockPanel Background="White">
<!-- Верхняя панель с комбобоксами -->
<StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center" Margin="20">
<!-- Первый ComboBox для выбора группы -->
<ComboBox ItemsSource="{Binding Groups}" SelectedValue="{Binding SelectedGroupItem}" HorizontalAlignment="Center" Width="300" Margin="10">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- Второй ComboBox для выбора способа сортировки -->
<ComboBox ItemsSource="{Binding SortOptions}" SelectedItem="{Binding SelectedSortOption}" HorizontalAlignment="Center" Width="300" Margin="10">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<!-- Центральная панель для списка студентов -->
<Border Padding="10" Background="LightGray">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<!-- Список студентов -->
<ListBox ItemsSource="{Binding Users}" HorizontalAlignment="Center" Width="350" Background="Bisque" Margin="10">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Header="Редактировать" Command="{Binding EditStudentCommand}" />
<MenuItem Header="Удалить выбранного" Command="{Binding RemoveSingleStudentCommand}" />
<MenuItem Header="Удалить выделенных" Command="{Binding RemoveSelectedStudentsCommand}" />
</ContextMenu>
</ListBox.ContextMenu>
</ListBox>
</StackPanel>
</Border>
<!-- Нижняя панель с кнопками -->
<StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="20">
<Button Content="Удалить всех студентов" Command="{Binding RemoveAllStudentsCommand}" HorizontalAlignment="Center" Width="250" Margin="10"/>
<Button Content="Добавить студента" Command="{Binding AddStudentCommand}" HorizontalAlignment="Center" Width="250" Margin="10"/>
</StackPanel>
</DockPanel>
</Window>