presence/Presence.Desktop/Views/MainWindow.axaml

123 lines
4.7 KiB
Plaintext
Raw Normal View History

2024-11-24 18:05:17 +00:00
<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"
2024-12-16 04:10:04 +00:00
x:DataType="vm:MainWindowViewModel"
2024-12-18 06:39:51 +00:00
xmlns:local="clr-namespace:Presence.Desktop.ViewModels"
2024-12-16 04:10:04 +00:00
DataContext="{Binding RelativeSource={RelativeSource Self}}">
2024-11-24 18:05:17 +00:00
2024-12-18 06:39:51 +00:00
<Window.Styles>
<Style Selector="TextBlock">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="FontSize" Value="14"/>
</Style>
<Style Selector="ComboBox">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Background" Value="#F0F0F0"/>
<Setter Property="BorderBrush" Value="#808080"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="FontSize" Value="14"/>
</Style>
<Style Selector="Button">
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="#4CAF50"/>
<Setter Property="BorderBrush" Value="#4CAF50"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="10"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="CornerRadius" Value="5"/>
</Style>
<Style Selector="ListBox">
<Setter Property="Background" Value="#FFE4C4"/>
<Setter Property="BorderBrush" Value="#808080"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="10"/>
<Setter Property="FontSize" Value="14"/>
</Style>
<Style Selector="MenuItem">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Background" Value="#F0F0F0"/>
<Setter Property="BorderBrush" Value="#808080"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="FontSize" Value="14"/>
</Style>
</Window.Styles>
<DockPanel Background="#F5F5F5">
2024-12-04 18:00:36 +00:00
<!-- Верхняя панель с комбобоксами -->
<StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center" Margin="20">
<!-- Первый ComboBox для выбора группы -->
2024-12-18 06:39:51 +00:00
<ComboBox ItemsSource="{Binding Groups}"
SelectedValue="{Binding SelectedGroupItem}"
HorizontalAlignment="Center"
Width="300"
Margin="5">
2024-12-02 10:04:59 +00:00
<ComboBox.ItemTemplate>
<DataTemplate>
2024-12-04 18:00:36 +00:00
<TextBlock Text="{Binding Name}" />
2024-12-02 10:04:59 +00:00
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
2024-12-04 18:00:36 +00:00
<!-- Второй ComboBox для выбора способа сортировки -->
2024-12-18 06:39:51 +00:00
<ComboBox ItemsSource="{Binding SortOptions}"
SelectedItem="{Binding SelectedSortOption}"
HorizontalAlignment="Center"
Width="300"
Margin="10">
2024-12-04 18:00:36 +00:00
<ComboBox.ItemTemplate>
2024-12-02 10:04:59 +00:00
<DataTemplate>
2024-12-04 18:00:36 +00:00
<TextBlock Text="{Binding}" />
2024-12-02 10:04:59 +00:00
</DataTemplate>
2024-12-04 18:00:36 +00:00
</ComboBox.ItemTemplate>
</ComboBox>
2024-12-18 06:39:51 +00:00
</StackPanel>
<!-- Нижняя панель с кнопками -->
<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"/>
2024-12-04 18:00:36 +00:00
</StackPanel>
<!-- Центральная панель для списка студентов -->
2024-12-16 04:10:04 +00:00
<ListBox ItemsSource="{Binding Users}"
2024-12-18 06:39:51 +00:00
HorizontalAlignment="Center"
Width="350"
Margin="10"
SelectionMode="Multiple"
SelectedItems="{Binding SelectedUsers}">
2024-12-16 04:10:04 +00:00
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="5">
2024-12-18 06:39:51 +00:00
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" />
2024-12-16 04:10:04 +00:00
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
2024-11-24 18:05:17 +00:00
2024-12-16 04:10:04 +00:00
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Header="Удалить" Click="OnDeleteUserClick"/>
<MenuItem Header="Редактировать" Click="OnEditUserClick"/>
</ContextMenu>
</ListBox.ContextMenu>
</ListBox>
2024-12-04 18:00:36 +00:00
</DockPanel>
2024-12-18 06:39:51 +00:00
</Window>