presence/Presence.Desktop/Views/MainWindow.axaml
2024-12-16 07:10:04 +03:00

66 lines
2.9 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"
xmlns:local="clr-namespace:Presence.Desktop.ViewModels"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
<DockPanel Background="White">
<!-- Верхняя панель с комбобоксами -->
<StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center" Margin="20">
<!-- Первый ComboBox для выбора группы -->
<ComboBox Foreground="Black" ItemsSource="{Binding Groups}" SelectedValue="{Binding SelectedGroupItem}" HorizontalAlignment="Center" Width="300" Margin="5">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- Второй ComboBox для выбора способа сортировки -->
<ComboBox Foreground="Black" ItemsSource="{Binding SortOptions}" SelectedItem="{Binding SelectedSortOption}" HorizontalAlignment="Center" Width="300" Margin="10">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="20">
<Button Foreground="Black" Content="Удалить всех студентов" Command="{Binding RemoveAllStudentsCommand}" HorizontalAlignment="Center" Width="250" Margin="10"/>
<Button Foreground="Black" Content="Добавить студента" Command="{Binding AddStudentCommand}" HorizontalAlignment="Center" Width="250" Margin="10"/>
</StackPanel>
</StackPanel>
<!-- Центральная панель для списка студентов -->
<ListBox ItemsSource="{Binding Users}"
HorizontalAlignment="Center"
Width="350"
Background="Bisque"
Margin="10"
SelectionMode="Multiple"
SelectedItems="{Binding SelectedUsers}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Foreground="Black" Text="{Binding Name}" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Header="Удалить" Click="OnDeleteUserClick"/>
<MenuItem Header="Редактировать" Click="OnEditUserClick"/>
</ContextMenu>
</ListBox.ContextMenu>
</ListBox>
</DockPanel>
</Window>