/
solostacktoolkit
/
structurator
Обзор
Документация
Войти
/
solostacktoolkit
/
structurator
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
1
Аналитика
Безопасность
master
Views/Controls/FormatCard.xaml
237 строк
10 KB
Артем Зиновьев
Initial commit: Структуратор 1.0
29 мар 2026, 08:39
29 мар 2026, 08:39
80f0f62
Код
Авторство
О чём код?
<UserControl x:Class="StructureSnap.Views.Controls.FormatCard" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Name="RootControl" Width="280" Height="380" Margin="8" Cursor="Hand" mc:Ignorable="d"> <UserControl.Triggers> <EventTrigger RoutedEvent="Loaded"> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetName="CardBorder" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.4" /> <DoubleAnimation Storyboard.TargetName="CardTransform" Storyboard.TargetProperty="Y" From="50" To="0" Duration="0:0:0.4"> <DoubleAnimation.EasingFunction> <BackEase EasingMode="EaseOut" /> </DoubleAnimation.EasingFunction> </DoubleAnimation> </Storyboard> </BeginStoryboard> </EventTrigger> </UserControl.Triggers> <Border x:Name="CardBorder" Background="White" BorderBrush="#E0E0E0" BorderThickness="1" CornerRadius="8" RenderTransformOrigin="0.5,0.5"> <Border.RenderTransform> <TransformGroup> <ScaleTransform x:Name="CardScale" ScaleX="1" ScaleY="1" /> <TranslateTransform x:Name="CardTransform" X="0" Y="0" /> </TransformGroup> </Border.RenderTransform> <!-- Основной контейнер с оптимизированными отступами --> <Grid Margin="16,16,16,16"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <!-- Заголовок карточки (иконка + название) - уменьшен отступ --> <StackPanel Grid.Row="0" Margin="0,0,0,4" Orientation="Horizontal"> <TextBlock Margin="0,0,8,0" VerticalAlignment="Center" FontSize="24" Text="{Binding Format.IconGlyph, ElementName=RootControl}" /> <TextBlock VerticalAlignment="Center" FontSize="16" FontWeight="SemiBold" Foreground="#333333" Text="{Binding Format.DisplayName, ElementName=RootControl}" /> </StackPanel> <!-- Описание формата - уменьшен отступ --> <TextBlock Grid.Row="1" MaxHeight="32" Margin="0,0,0,8" FontSize="12" Foreground="#666666" Text="{Binding Format.Description, ElementName=RootControl}" TextWrapping="Wrap" /> <!-- Область превью - занимает максимум доступного места --> <Border Grid.Row="2" MinHeight="80" MaxHeight="200" Padding="8" Background="#F5F5F5" CornerRadius="4"> <Grid> <!-- Текстовое превью (JSON, Tree, CSV) --> <TextBlock x:Name="TextPreviewBlock" MaxHeight="180" FontFamily="Consolas" FontSize="11" Foreground="#444444" Text="{Binding Preview.TextPreview, ElementName=RootControl}" TextWrapping="Wrap" Visibility="Visible" /> <!-- Изображение превью (PNG) --> <Image x:Name="ImagePreviewBlock" MaxHeight="180" Stretch="Uniform" Visibility="Collapsed" /> <!-- Индикатор загрузки --> <ProgressBar x:Name="LoadingIndicator" Height="4" VerticalAlignment="Bottom" IsIndeterminate="True" Visibility="Collapsed" /> </Grid> </Border> <!-- Статистика (количество элементов) - компактный отступ --> <TextBlock Grid.Row="3" Margin="0,6,0,0" FontSize="11" Foreground="#888888" Text="{Binding Preview.SizeHint, ElementName=RootControl}" /> <!-- Кнопка экспорта - минимальные отступы --> <Button x:Name="ExportButton" Grid.Row="4" Margin="0,8,0,0" Padding="12,6" HorizontalAlignment="Stretch" Background="#4CAF50" BorderThickness="0" Command="{Binding ExportCommand, ElementName=RootControl}" Content="📥 Экспортировать" Cursor="Hand" FontSize="13" FontWeight="SemiBold" Foreground="White" Visibility="Collapsed"> <Button.Style> <Style TargetType="Button"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" CornerRadius="4"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="#45A049" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Background" Value="#CCCCCC" /> <Setter Property="Foreground" Value="#888888" /> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <!-- Сообщение об ошибке - размещено поверх превью --> <TextBlock Grid.Row="2" Padding="8" VerticalAlignment="Center" Background="#F5F5F5" FontSize="11" Foreground="#F44336" Text="{Binding ErrorMessage, ElementName=RootControl}" TextAlignment="Center" TextWrapping="Wrap" Visibility="Collapsed"> <TextBlock.Style> <Style TargetType="TextBlock"> <Style.Triggers> <DataTrigger Binding="{Binding ErrorMessage, ElementName=RootControl}" Value="{x:Null}"> <Setter Property="Visibility" Value="Collapsed" /> </DataTrigger> <DataTrigger Binding="{Binding ErrorMessage, ElementName=RootControl}" Value=""> <Setter Property="Visibility" Value="Collapsed" /> </DataTrigger> </Style.Triggers> </Style> </TextBlock.Style> </TextBlock> </Grid> </Border> <UserControl.Style> <Style TargetType="UserControl"> <Setter Property="RenderTransform"> <Setter.Value> <ScaleTransform CenterX="140" CenterY="190" ScaleX="1" ScaleY="1" /> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="RenderTransform"> <Setter.Value> <ScaleTransform CenterX="140" CenterY="190" ScaleX="1.03" ScaleY="1.03" /> </Setter.Value> </Setter> <Setter Property="Effect"> <Setter.Value> <DropShadowEffect BlurRadius="12" Opacity="0.25" ShadowDepth="4" Color="#000000" /> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style> </UserControl.Style> </UserControl>