presence/Presence.Desktop/Views/GroupView.axaml

145 lines
6.6 KiB
Plaintext
Raw Normal View History

2024-12-18 07:19:58 +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"
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="#333333"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="Medium"/>
</Style>
<Style Selector="ComboBox">
<Setter Property="Foreground" Value="#333333"/>
<Setter Property="Background" Value="#FFFFFF"/>
<Setter Property="BorderBrush" Value="#CCCCCC"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="8"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="BoxShadow" Value="0 2px 4px rgba(0, 0, 0, 0.1)"/>
</Style>
<Style Selector="Button">
<Setter Property="Foreground" Value="#FFFFFF"/>
<Setter Property="Background" Value="#0078D7"/>
<Setter Property="BorderBrush" Value="#0078D7"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="12"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="BoxShadow" Value="0 2px 4px rgba(0, 0, 0, 0.1)"/>
<Setter Property="Cursor" Value="Pointer"/>
<Setter Property="Transitions">
<Transitions>
<Transitions.BoxShadow>
<BoxShadowTransition Duration="0:0:0.2"/>
</Transitions.BoxShadow>
<Transitions.Background>
<BrushTransition Duration="0:0:0.2"/>
</Transitions.Background>
</Transitions>
</Setter>
<Setter Property="PointerOverBackground" Value="#005A9E"/>
<Setter Property="PressedBackground" Value="#004C87"/>
</Style>
<Style Selector="ListBox">
<Setter Property="Background" Value="#FFFFFF"/>
<Setter Property="BorderBrush" Value="#CCCCCC"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="10"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="BoxShadow" Value="0 2px 4px rgba(0, 0, 0, 0.1)"/>
</Style>
<Style Selector="MenuItem">
<Setter Property="Foreground" Value="#333333"/>
<Setter Property="Background" Value="#FFFFFF"/>
<Setter Property="BorderBrush" Value="#CCCCCC"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="8"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="CornerRadius" Value="4"/>
<Setter Property="PointerOverBackground" Value="#EAEAEA"/>
</Style>
</Window.Styles>
<DockPanel Background="#F9F9F9">
<!-- Верхняя панель с комбобоксами -->
<StackPanel DockPanel.Dock="Top"
HorizontalAlignment="Center"
Margin="20"
Spacing="15">
<!-- Первый ComboBox для выбора группы -->
<ComboBox ItemsSource="{Binding Groups}"
SelectedValue="{Binding SelectedGroupItem}"
HorizontalAlignment="Center"
Width="300">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- Второй ComboBox для выбора способа сортировки -->
<ComboBox ItemsSource="{Binding SortOptions}"
SelectedItem="{Binding SelectedSortOption}"
HorizontalAlignment="Center"
Width="300">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<!-- Нижняя панель с кнопками -->
<StackPanel DockPanel.Dock="Bottom"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="20"
Spacing="15">
<Button Content="Удалить всех студентов"
Command="{Binding RemoveAllStudentsCommand}"
HorizontalAlignment="Center"
Width="250"/>
<Button Content="Добавить студента"
Command="{Binding AddStudentCommand}"
HorizontalAlignment="Center"
Width="250"/>
</StackPanel>
<!-- Центральная панель для списка студентов -->
<ListBox ItemsSource="{Binding Users}"
HorizontalAlignment="Center"
Width="400"
Margin="20"
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>