presence/Presence.Desktop/Views/MainWindow.axaml
2024-12-18 09:39:51 +03:00

123 lines
4.7 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}}">
<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">
<!-- Верхняя панель с комбобоксами -->
<StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center" Margin="20">
<!-- Первый ComboBox для выбора группы -->
<ComboBox 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 ItemsSource="{Binding SortOptions}"
SelectedItem="{Binding SelectedSortOption}"
HorizontalAlignment="Center"
Width="300"
Margin="10">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</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"/>
</StackPanel>
<!-- Центральная панель для списка студентов -->
<ListBox ItemsSource="{Binding Users}"
HorizontalAlignment="Center"
Width="350"
Margin="10"
SelectionMode="Multiple"
SelectedItems="{Binding SelectedUsers}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock 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>