forked from amkovkov/GranuSightSoftware2
feat: fix separator calibration after database reforge
+ add comments + refactoring
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,205 +1,264 @@
|
||||
<UserControl
|
||||
x:Class="GSS2.Views.AmineContent.SeparatorCalibrationView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:GSS2.ViewModels.AmineContent"
|
||||
xmlns:converters="using:GSS2.UI.Core.Converters"
|
||||
xmlns:avalonia_converters="using:Avalonia.Data.Converters"
|
||||
xmlns:i="using:Avalonia.Xaml.Interactivity"
|
||||
xmlns:ia="using:Avalonia.Xaml.Interactions.Custom"
|
||||
x:DataType="vm:SeparatorCalibrationViewModel"
|
||||
xmlns:controls="using:GSS2.Controls"
|
||||
xmlns:core="using:GSS2.UI.Core"
|
||||
xmlns:i="using:Avalonia.Xaml.Interactivity"
|
||||
xmlns:ia="using:Avalonia.Xaml.Interactions.Custom"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
x:DataType="vm:SeparatorCalibrationViewModel">
|
||||
|
||||
<UserControl.Resources>
|
||||
<converters:NotEqualsConverter x:Key="NotEqualsConverter" />
|
||||
<converters:EqualsConverter x:Key="EqualsConverter" />
|
||||
<converters:DateTimeConverter x:Key="DateTimeConverter" />
|
||||
|
||||
<SolidColorBrush x:Key="MenuBackground" Color="#00357a" />
|
||||
<SolidColorBrush x:Key="MenuBorder" Color="#0865b2" />
|
||||
<SolidColorBrush x:Key="Overlay" Color="#0865b23f" />
|
||||
<SolidColorBrush x:Key="ButtonBackground" Color="#0865b2" />
|
||||
<SolidColorBrush x:Key="ButtonDangerBackground" Color="#b20808" />
|
||||
<SolidColorBrush x:Key="ButtonForeground" Color="#ffffff" />
|
||||
<SolidColorBrush x:Key="MainBackground" Color="#001e46" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<UserControl.Styles>
|
||||
|
||||
<Style Selector="Button">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="Background" Value="{StaticResource ButtonBackground}" />
|
||||
<Setter Property="Foreground" Value="{StaticResource ButtonForeground}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button.danger">
|
||||
<Setter Property="Background" Value="{StaticResource ButtonDangerBackground}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button.vertical">
|
||||
<Setter Property="MinWidth" Value="40" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBox">
|
||||
<Setter Property="FontSize" Value="20"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBox.singleline">
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBox.multiline">
|
||||
<Setter Property="VerticalContentAlignment" Value="Top" />
|
||||
<Setter Property="AcceptsReturn" Value="True" />
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBlock">
|
||||
<Setter Property="FontSize" Value="20"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBlock.mini">
|
||||
<Setter Property="FontSize" Value="16"/>
|
||||
<Setter Property="Margin" Value="0,0,0,0" />
|
||||
</Style>
|
||||
|
||||
</UserControl.Styles>
|
||||
xmlns:vm="using:GSS2.ViewModels.AmineContent"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
>
|
||||
|
||||
<Grid Background="{StaticResource MainBackground}">
|
||||
|
||||
<!-- Основная форма -->
|
||||
<Grid IsEnabled="{Binding !MenuOpened}" ColumnSpacing="5" RowSpacing="5">
|
||||
<Grid IsEnabled="{Binding !MenuOpened}">
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" /> <!-- Кнопка "Удалить" -->
|
||||
<ColumnDefinition Width="*" /> <!-- Кнопка "Сохранить" -->
|
||||
<ColumnDefinition Width="*" /> <!-- Кнопки "К информации"/"К изображению" -->
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.ColumnSpacing>5</Grid.ColumnSpacing>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" /> <!-- Главная панель -->
|
||||
<RowDefinition Height="*" /> <!-- Главная панель -->
|
||||
<RowDefinition Height="Auto" /> <!-- Кнопки главной панели -->
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" /> <!-- Удалить -->
|
||||
<ColumnDefinition Width="*" /> <!-- Сохранить -->
|
||||
<ColumnDefinition Width="*" /> <!-- К информации/К изображению -->
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowSpacing>5</Grid.RowSpacing>
|
||||
|
||||
<!-- Главная панель -->
|
||||
<core:SectionPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
<core:SectionPanel
|
||||
CanScrollBackward="{Binding MainSectionCanScrollBackward}"
|
||||
CanScrollForward="{Binding MainSectionCanScrollForward}"
|
||||
ClipToBounds="True"
|
||||
CurrentIndex="{Binding MainSectionCurrentIndex}"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
IsScrolling="{Binding MainSectionIsScrolling}"
|
||||
Orientation="Vertical">
|
||||
Orientation="Vertical"
|
||||
>
|
||||
|
||||
<!-- Информация -->
|
||||
<Grid ColumnSpacing="5" RowSpacing="5">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" /> <!-- ИД (подпись) -->
|
||||
<RowDefinition Height="Auto" /> <!-- ИД (поле) -->
|
||||
<RowDefinition Height="Auto" /> <!-- Тип (подпись) -->
|
||||
<RowDefinition Height="Auto" /> <!-- Тип (поле) -->
|
||||
<RowDefinition Height="Auto" /> <!-- Партия (подпись) -->
|
||||
<RowDefinition Height="Auto" /> <!-- Партия (поле) -->
|
||||
<RowDefinition Height="*" /> <!-- Пустое пространство -->
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" /> <!-- Кнопка меню -->
|
||||
<ColumnDefinition Width="*" /> <!-- Информация -->
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.ColumnSpacing>5</Grid.ColumnSpacing>
|
||||
|
||||
<!-- Кнопка меню -->
|
||||
<Button Grid.Column="0" Grid.Row="0" Grid.RowSpan="7" Classes="vertical" VerticalAlignment="Stretch" Command="{Binding ToggleMenuCommand}">
|
||||
<Button
|
||||
Classes="vertical"
|
||||
Command="{Binding ToggleMenuCommand}"
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Stretch"
|
||||
>
|
||||
<TextBlock Text="☰"/>
|
||||
</Button>
|
||||
|
||||
<!-- Id / Uuid / Type -->
|
||||
<Grid Grid.Column="1">
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.ColumnSpacing>5</Grid.ColumnSpacing>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" /> <!-- Id (подпись) | Uuid (подпись) -->
|
||||
<RowDefinition Height="Auto" /> <!-- Id (поле ) | Uuid (поле ) -->
|
||||
<RowDefinition Height="Auto" /> <!-- Type (подпись) -->
|
||||
<RowDefinition Height="Auto" /> <!-- Type (поле ) -->
|
||||
<RowDefinition Height="*" /> <!-- Пустое пространство -->
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.RowSpacing>5</Grid.RowSpacing>
|
||||
|
||||
<!-- Id (подпись) -->
|
||||
<TextBlock
|
||||
Classes="mini"
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
Text="ИД:"
|
||||
/>
|
||||
<!-- Id (поле) -->
|
||||
<TextBox
|
||||
Classes="singleline"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
IsReadOnly="True"
|
||||
PlaceholderText="ИД"
|
||||
Text="{Binding SelectedId}"
|
||||
/>
|
||||
<!-- Uuid (подпись) -->
|
||||
<TextBlock
|
||||
Classes="mini"
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
Text="Уникальный ИД:"
|
||||
/>
|
||||
<!-- Uuid (поле) -->
|
||||
<TextBox
|
||||
Classes="singleline"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
IsReadOnly="True"
|
||||
PlaceholderText="Уникальный ИД"
|
||||
Text="{Binding SelectedUuid}"
|
||||
/>
|
||||
<!-- Type (подпись) -->
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Classes="mini"
|
||||
Text="Тип:"
|
||||
/>
|
||||
<!-- Type (поле) -->
|
||||
<controls:TouchTextBox
|
||||
Classes="singleline"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="3"
|
||||
PlaceholderText="Тип"
|
||||
Text="{Binding SelectedType}"
|
||||
/>
|
||||
|
||||
</Grid>
|
||||
|
||||
<!-- Информация -->
|
||||
<!-- ИД (подпись) -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Classes="mini" Text="ИД:" />
|
||||
<!-- ИД (поле) -->
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Classes="singleline" Text="{Binding EditingRecord.Id}" PlaceholderText="ИД" IsReadOnly="True" />
|
||||
<!-- Тип (подпись) -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Classes="mini" Text="Тип:" />
|
||||
<!-- Тип (поле) -->
|
||||
<controls:TouchTextBox Grid.Row="3" Grid.Column="1" Classes="singleline" Text="{Binding EditingRecord.Type}" PlaceholderText="Тип" />
|
||||
<!-- Партия (подпись) -->
|
||||
<TextBlock Grid.Row="4" Grid.Column="1" Classes="mini" Text="Партия:" />
|
||||
<!-- Партия (поле) -->
|
||||
<controls:TouchTextBox Grid.Row="5" Grid.Column="1" Classes="singleline" Text="{Binding EditingRecord.Batch}" PlaceholderText="Партия" />
|
||||
<Grid Grid.Column="1">
|
||||
<!-- ИД (подпись) -->
|
||||
<!-- <TextBlock Grid.Row="0" Grid.Column="1" Classes="mini" Text="ИД:" /> -->
|
||||
<!-- ИД (поле) -->
|
||||
<!-- <TextBox Grid.Row="1" Grid.Column="1" Classes="singleline" Text="{Binding EditingRecord.Id}" PlaceholderText="ИД" IsReadOnly="True" /> -->
|
||||
<!-- Тип (подпись) -->
|
||||
<!-- <TextBlock Grid.Row="2" Grid.Column="1" Classes="mini" Text="Тип:" /> -->
|
||||
<!-- Тип (поле) -->
|
||||
<!-- <controls:TouchTextBox Grid.Row="3" Grid.Column="1" Classes="singleline" Text="{Binding EditingRecord.Type}" PlaceholderText="Тип" /> -->
|
||||
<!-- Партия (подпись) -->
|
||||
<!-- <TextBlock Grid.Row="4" Grid.Column="1" Classes="mini" Text="Партия:" /> -->
|
||||
<!-- Партия (поле) -->
|
||||
<!-- <controls:TouchTextBox Grid.Row="5" Grid.Column="1" Classes="singleline" Text="{Binding EditingRecord.Batch}" PlaceholderText="Партия" /> -->
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
<!-- Изображение -->
|
||||
<Grid ColumnSpacing="5" RowSpacing="5">
|
||||
<Grid>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" /> <!-- Изображение -->
|
||||
<RowDefinition Height="Auto" /> <!-- Кнопка "Получить изображения" / "Отменить съёмку" -->
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.RowSpacing>5</Grid.RowSpacing>
|
||||
|
||||
<!-- Изображение -->
|
||||
<Grid>
|
||||
|
||||
<!-- Изображение -->
|
||||
<Grid>
|
||||
|
||||
<Grid.IsVisible>
|
||||
</Grid>
|
||||
|
||||
<!-- Изображение -->
|
||||
<core:ZoomPanImage
|
||||
Background="Black"
|
||||
HorizontalAlignment="Stretch"
|
||||
ImageSource="{Binding SelectedImage.Image}"
|
||||
IsVisible="{Binding SelectedImage.IsLoading, Converter={x:Static BoolConverters.Not}}"
|
||||
VerticalAlignment="Stretch"
|
||||
>
|
||||
|
||||
<core:ZoomPanImage.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Converter="{x:Static ObjectConverters.IsNotNull}" Path="Image" />
|
||||
<Binding Converter="{x:Static ObjectConverters.IsNotNull}" Path="SelectedImage.Data" />
|
||||
<Binding Converter="{x:Static BoolConverters.Not}" Path="SelectedImage.IsLoading" />
|
||||
<Binding Converter="{x:Static BoolConverters.Not}" Path="ImagesIsCapturing" />
|
||||
</MultiBinding>
|
||||
</Grid.IsVisible>
|
||||
</core:ZoomPanImage.IsVisible>
|
||||
|
||||
<!-- Изображение -->
|
||||
<core:ZoomPanImage HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
ImageSource="{Binding Image.Image}"
|
||||
Background="Black"
|
||||
IsVisible="{Binding Image.IsLoading, Converter={x:Static BoolConverters.Not}}" />
|
||||
</core:ZoomPanImage>
|
||||
|
||||
<!-- Оверлей загрузки -->
|
||||
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" IsVisible="{Binding Image.IsLoading}">
|
||||
<ProgressBar IsIndeterminate="True" />
|
||||
<TextBlock HorizontalAlignment="Center" Text="Изображение загружается" />
|
||||
</StackPanel>
|
||||
<!-- Оверлей "Изображение загружается" -->
|
||||
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" >
|
||||
|
||||
</Grid>
|
||||
<StackPanel.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Path="SelectedImage.IsLoading" />
|
||||
<Binding Converter="{x:Static BoolConverters.Not}" Path="ImagesIsCapturing" />
|
||||
</MultiBinding>
|
||||
</StackPanel.IsVisible>
|
||||
|
||||
<!-- Оверлей "Изображения отсутствуют" -->
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="Изображения отсутствуют">
|
||||
<ProgressBar IsIndeterminate="True" />
|
||||
|
||||
<TextBlock HorizontalAlignment="Center" Text="Изображение загружается" />
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<!-- Оверлей "Изображение отсутствует" -->
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
Text="Изображение отсутствует"
|
||||
VerticalAlignment="Center"
|
||||
>
|
||||
<TextBlock.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Converter="{x:Static ObjectConverters.IsNull}" Path="Image" />
|
||||
<Binding Converter="{x:Static ObjectConverters.IsNull}" Path="SelectedImage.Data" />
|
||||
<Binding Converter="{x:Static BoolConverters.Not}" Path="SelectedImage.IsLoading" />
|
||||
<Binding Converter="{x:Static BoolConverters.Not}" Path="ImagesIsCapturing" />
|
||||
</MultiBinding>
|
||||
</TextBlock.IsVisible>
|
||||
</TextBlock>
|
||||
|
||||
<!-- Оверлей прогресс -->
|
||||
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" IsVisible="{Binding ImagesIsCapturing}">
|
||||
<StackPanel
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
>
|
||||
|
||||
<StackPanel.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Converter="{x:Static ObjectConverters.IsNull}" Path="SelectedImage.Data" />
|
||||
<Binding Converter="{x:Static BoolConverters.Not}" Path="SelectedImage.IsLoading" />
|
||||
<Binding Path="ImagesIsCapturing" />
|
||||
</MultiBinding>
|
||||
</StackPanel.IsVisible>
|
||||
|
||||
<ProgressBar IsIndeterminate="True" />
|
||||
|
||||
<TextBlock HorizontalAlignment="Center" Text="{Binding ImagesCapturingProgress}" />
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
<!-- Кнопка "Получить изображения" -->
|
||||
<Button Grid.Row="1"
|
||||
<Button
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
Command="{Binding CaptureImageCommand}"
|
||||
IsVisible="{Binding CaptureImagesTask, Converter={x:Static ObjectConverters.IsNull}}">
|
||||
>
|
||||
<TextBlock Text="Получить изображения"/>
|
||||
</Button>
|
||||
|
||||
<!-- Кнопка "Отменить съёмку" -->
|
||||
<Button Grid.Row="1"
|
||||
<Button
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
Command="{Binding CancelImageCapturingCommand}"
|
||||
IsVisible="{Binding CaptureImagesTask, Converter={x:Static ObjectConverters.IsNotNull}}">
|
||||
>
|
||||
<TextBlock Text="Отменить съёмку"/>
|
||||
</Button>
|
||||
|
||||
@@ -208,22 +267,37 @@
|
||||
</core:SectionPanel>
|
||||
|
||||
<!-- Кнопки главной панели -->
|
||||
<!-- Удалить -->
|
||||
<Button Grid.Row="1" Grid.Column="0" HorizontalAlignment="Stretch" Classes="danger" Command="{Binding DeleteRecordCommand}">
|
||||
<!-- Кнопка "Удалить" -->
|
||||
<Button
|
||||
Classes="danger"
|
||||
Command="{Binding DeleteRecordCommand}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
>
|
||||
<TextBlock Text="Удалить"/>
|
||||
</Button>
|
||||
|
||||
<!-- Сохранить -->
|
||||
<Button Grid.Row="1" Grid.Column="1" HorizontalAlignment="Stretch" Command="{Binding SaveRecordCommand}" Content="Сохранить">
|
||||
<!-- Кнопка "Сохранить" -->
|
||||
<Button
|
||||
Command="{Binding SaveRecordCommand}"
|
||||
Content="Сохранить"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
>
|
||||
<TextBlock Text="Сохранить"/>
|
||||
</Button>
|
||||
|
||||
<!-- К информации -->
|
||||
<Button Grid.Row="1" Grid.Column="2"
|
||||
HorizontalAlignment="Stretch"
|
||||
<!-- Кнопка "К информации" -->
|
||||
<Button
|
||||
Command="{Binding SwitchMainSectionCommand}"
|
||||
Content="К информации"
|
||||
IsVisible="{Binding MainSectionCurrentIndex, Converter={StaticResource EqualsConverter}, ConverterParameter=1}">
|
||||
Grid.Column="2"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
IsVisible="{Binding MainSectionCurrentIndex, Converter={StaticResource EqualsConverter}, ConverterParameter=1}"
|
||||
>
|
||||
|
||||
<TextBlock Text="К информации"/>
|
||||
|
||||
@@ -236,12 +310,15 @@
|
||||
|
||||
</Button>
|
||||
|
||||
<!-- К изображению -->
|
||||
<Button Grid.Row="1" Grid.Column="2"
|
||||
HorizontalAlignment="Stretch"
|
||||
<!-- Кнопка "К изображению" -->
|
||||
<Button
|
||||
Command="{Binding SwitchMainSectionCommand}"
|
||||
Content="К изображению"
|
||||
IsVisible="{Binding MainSectionCurrentIndex, Converter={StaticResource EqualsConverter}, ConverterParameter=0}">
|
||||
Grid.Column="2"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
IsVisible="{Binding MainSectionCurrentIndex, Converter={StaticResource EqualsConverter}, ConverterParameter=0}"
|
||||
>
|
||||
|
||||
<TextBlock Text="К изображению"/>
|
||||
|
||||
@@ -257,7 +334,11 @@
|
||||
</Grid>
|
||||
|
||||
<!-- Полупрозрачный оверлей -->
|
||||
<Border Background="{StaticResource Overlay}" IsEnabled="{Binding MenuOpened}" IsVisible="{Binding MenuOpened}">
|
||||
<Border
|
||||
Background="{StaticResource Overlay}"
|
||||
IsEnabled="{Binding MenuOpened}"
|
||||
IsVisible="{Binding MenuOpened}"
|
||||
>
|
||||
<Interaction.Behaviors>
|
||||
<TappedTrigger>
|
||||
<InvokeCommandAction Command="{Binding CloseMenuCommand}" />
|
||||
@@ -266,72 +347,111 @@
|
||||
</Border>
|
||||
|
||||
<!-- Выезжающая боковая панель -->
|
||||
<Border HorizontalAlignment="Left"
|
||||
Background="{StaticResource MenuBackground}" BorderBrush="{StaticResource MenuBorder}" BorderThickness="0,0,1,0"
|
||||
IsEnabled="{Binding MenuOpened}" IsVisible="{Binding MenuOpened}">
|
||||
<Border
|
||||
Background="{StaticResource MenuBackground}"
|
||||
BorderBrush="{StaticResource MenuBorder}"
|
||||
BorderThickness="0,0,1,0"
|
||||
HorizontalAlignment="Left"
|
||||
IsEnabled="{Binding MenuOpened}"
|
||||
IsVisible="{Binding MenuOpened}"
|
||||
>
|
||||
|
||||
<!-- Переходы -->
|
||||
<Border.Transitions>
|
||||
<Transitions>
|
||||
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.25" />
|
||||
<TransformOperationsTransition Duration="0:0:0.25" Property="RenderTransform" />
|
||||
</Transitions>
|
||||
</Border.Transitions>
|
||||
|
||||
<!-- Поведения -->
|
||||
<Interaction.Behaviors>
|
||||
|
||||
<DataTriggerBehavior Binding="{Binding MenuOpened}" ComparisonCondition="Equal" Value="True">
|
||||
<!-- Поведение при открытии меню -->
|
||||
<DataTriggerBehavior
|
||||
Binding="{Binding MenuOpened}"
|
||||
ComparisonCondition="Equal"
|
||||
Value="True"
|
||||
>
|
||||
<ChangePropertyAction PropertyName="RenderTransform" Value="translateX(0px)" />
|
||||
</DataTriggerBehavior>
|
||||
|
||||
<DataTriggerBehavior Binding="{Binding MenuOpened}" ComparisonCondition="Equal" Value="False">
|
||||
<!-- Поведение при закрытии меню -->
|
||||
<DataTriggerBehavior
|
||||
Binding="{Binding MenuOpened}"
|
||||
ComparisonCondition="Equal"
|
||||
Value="False"
|
||||
>
|
||||
<ChangePropertyAction PropertyName="RenderTransform" Value="translateX(-320px)" />
|
||||
</DataTriggerBehavior>
|
||||
|
||||
</Interaction.Behaviors>
|
||||
|
||||
<!-- Содержимое меню -->
|
||||
<Grid RowSpacing="10" Margin="10">
|
||||
<Grid Margin="10">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/> <!-- Кнопка "Новая запись" -->
|
||||
<RowDefinition Height="*"/> <!-- Элементы меню -->
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Button Grid.Row="0" MinWidth="200" HorizontalAlignment="Stretch" Command="{Binding CreateRecordCommand}">
|
||||
<Grid.RowSpacing>10</Grid.RowSpacing>
|
||||
|
||||
<!-- Кнопка "Новая запись" -->
|
||||
<Button
|
||||
Command="{Binding CreateRecordCommand}"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
MinWidth="200"
|
||||
>
|
||||
<TextBlock Text="Новая запись"/>
|
||||
</Button>
|
||||
|
||||
<ListBox Grid.Row="1" Background="{StaticResource MenuBackground}" ItemsSource="{Binding Records}" SelectedItem="{Binding SelectedRecord}">
|
||||
<!-- Элементы меню -->
|
||||
<ListBox
|
||||
Background="{StaticResource MenuBackground}"
|
||||
Grid.Row="1"
|
||||
ItemsSource="{Binding MenuItems}"
|
||||
SelectedIndex="{Binding MenuSelectedIndex}"
|
||||
>
|
||||
|
||||
<!-- Шаблон списка элементов -->
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
|
||||
<!-- Стили элементов -->
|
||||
<ListBox.Styles>
|
||||
|
||||
<!-- Общий стиль -->
|
||||
<Style Selector="ListBoxItem">
|
||||
<Setter Property="Background" Value="{StaticResource ButtonBackground}" />
|
||||
</Style>
|
||||
|
||||
<!-- Стиль выбранного элемента -->
|
||||
<Style Selector="ListBoxItem:selected /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{StaticResource MainBackground}" />
|
||||
</Style>
|
||||
|
||||
<!-- Стиль элемента над которым находится указатель -->
|
||||
<Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{StaticResource MainBackground}" />
|
||||
</Style>
|
||||
|
||||
</ListBox.Styles>
|
||||
|
||||
<!-- Шаблон элемента -->
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<DataTemplate x:DataType="vm:SeparatorCalibrationViewModel+MenuItemViewModel">
|
||||
<Border Margin="3" CornerRadius="5">
|
||||
<TextBlock Classes="mini" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Classes="mini"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
>
|
||||
<Run Text="{Binding Id, StringFormat='[{0}] '}" />
|
||||
<Run Text="{Binding Type}" />
|
||||
<Run Text=": " />
|
||||
<Run Text="{Binding Batch}" />
|
||||
</TextBlock>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
|
||||
Reference in New Issue
Block a user