/
solostacktoolkit
/
novaflowwpf
Обзор
Документация
Войти
/
solostacktoolkit
/
novaflowwpf
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Controls/DropPanel.xaml
227 строк
12 KB
Артем Зиновьев
Добавлен Demo
06 мар 2026, 23:48
06 мар 2026, 23:48
772764d
Код
Авторство
О чём код?
<UserControl x:Class="NovaFlow.Controls.DropPanel" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:NovaFlow.Controls" x:Name="Root"> <UserControl.Resources> <DropShadowEffect x:Key="GlassShadow" BlurRadius="12" Opacity="0.4" ShadowDepth="3" Color="#dc2f02"/> <SolidColorBrush x:Key="GlassBackground" Color="#370617"/> <SolidColorBrush x:Key="GlassBorder" Color="#dc2f02"/> <SolidColorBrush x:Key="GlassHeader" Color="#6a040f"/> <SolidColorBrush x:Key="GlassText" Color="#E0E0E0"/> <SolidColorBrush x:Key="GlassHover" Color="#9d0208"/> <SolidColorBrush x:Key="GlassAccent" Color="#ffba08"/> <Style x:Key="MenuItemButtonStyle" TargetType="Button"> <Setter Property="Background" Value="Transparent"/> <Setter Property="Foreground" Value="{StaticResource GlassText}"/> <Setter Property="BorderBrush" Value="#404040"/> <Setter Property="BorderThickness" Value="1"/> <Setter Property="Padding" Value="0"/> <Setter Property="Margin" Value="0"/> <Setter Property="Cursor" Value="Hand"/> <Setter Property="FontSize" Value="13"/> <Setter Property="Width" Value="160"/> <Setter Property="Height" Value="36"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4" Padding="0"> <Grid Margin="0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="36"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <ContentControl Grid.Column="0" Content="{Binding IconControl}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource GlassText}" Margin="0"/> <TextBlock Grid.Column="1" Text="{Binding DisplayText}" VerticalAlignment="Center" HorizontalAlignment="Left" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" Margin="8,0,4,0" Foreground="{StaticResource GlassText}"/> </Grid> </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter TargetName="border" Property="Background" Value="{StaticResource GlassHover}"/> <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource GlassBorder}"/> <Setter TargetName="border" Property="Effect"> <Setter.Value> <DropShadowEffect Color="#dc2f02" BlurRadius="10" Opacity="0.5"/> </Setter.Value> </Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="ToggleButton" x:Key="GlassToggleButton"> <Setter Property="Background" Value="{StaticResource GlassHeader}"/> <Setter Property="Foreground" Value="{StaticResource GlassText}"/> <Setter Property="BorderBrush" Value="{StaticResource GlassBorder}"/> <Setter Property="BorderThickness" Value="1"/> <Setter Property="FontSize" Value="14"/> <Setter Property="FontWeight" Value="SemiBold"/> <Setter Property="Padding" Value="15,8"/> <Setter Property="Cursor" Value="Hand"/> <Setter Property="Effect" Value="{StaticResource GlassShadow}"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ToggleButton"> <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> <ControlTemplate.Triggers> <Trigger Property="IsChecked" Value="True"> <Setter TargetName="border" Property="Background" Value="{StaticResource GlassBorder}"/> <Setter TargetName="border" Property="Opacity" Value="0.95"/> <Setter Property="Foreground" Value="White"/> </Trigger> <Trigger Property="IsMouseOver" Value="True"> <Setter TargetName="border" Property="Background" Value="#cc9d0208"/> <Setter TargetName="border" Property="Effect"> <Setter.Value> <DropShadowEffect Color="#dc2f02" BlurRadius="15" Opacity="0.6"/> </Setter.Value> </Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </UserControl.Resources> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <ToggleButton Grid.Row="0" x:Name="HeaderToggle" Content="{Binding Header, ElementName=Root}" IsChecked="{Binding IsExpanded, ElementName=Root, Mode=TwoWay}" Style="{StaticResource GlassToggleButton}"/> <Border Grid.Row="1" x:Name="ContentPanel" Background="{StaticResource GlassBackground}" BorderBrush="{StaticResource GlassBorder}" BorderThickness="1" CornerRadius="0,0,8,8" Margin="0,2,0,0" Effect="{StaticResource GlassShadow}" Visibility="Collapsed" Opacity="0" RenderTransformOrigin="0.5,0"> <Border.RenderTransform> <TranslateTransform Y="-10"/> </Border.RenderTransform> <Border.Style> <Style TargetType="Border"> <Style.Triggers> <DataTrigger Binding="{Binding IsChecked, ElementName=HeaderToggle}" Value="True"> <DataTrigger.EnterActions> <BeginStoryboard> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"> <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}"/> </ObjectAnimationUsingKeyFrames> <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.2"> <DoubleAnimation.EasingFunction> <QuadraticEase EasingMode="EaseOut"/> </DoubleAnimation.EasingFunction> </DoubleAnimation> <DoubleAnimation Storyboard.TargetProperty="RenderTransform.(TranslateTransform.Y)" To="0" Duration="0:0:0.2"> <DoubleAnimation.EasingFunction> <QuadraticEase EasingMode="EaseOut"/> </DoubleAnimation.EasingFunction> </DoubleAnimation> </Storyboard> </BeginStoryboard> </DataTrigger.EnterActions> <DataTrigger.ExitActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.15"> <DoubleAnimation.EasingFunction> <QuadraticEase EasingMode="EaseIn"/> </DoubleAnimation.EasingFunction> </DoubleAnimation> <DoubleAnimation Storyboard.TargetProperty="RenderTransform.(TranslateTransform.Y)" To="-10" Duration="0:0:0.15"> <DoubleAnimation.EasingFunction> <QuadraticEase EasingMode="EaseIn"/> </DoubleAnimation.EasingFunction> </DoubleAnimation> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"> <DiscreteObjectKeyFrame KeyTime="0:0:0.15" Value="{x:Static Visibility.Collapsed}"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </DataTrigger.ExitActions> </DataTrigger> </Style.Triggers> </Style> </Border.Style> <ItemsControl x:Name="ItemsControl" Margin="8" ItemsSource="{Binding Items, ElementName=Root}"> <ItemsControl.ItemTemplate> <DataTemplate> <Button Style="{StaticResource MenuItemButtonStyle}" Command="{Binding ElementName=Root, Path=ItemSelectedCommand}" CommandParameter="{Binding}"/> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </Border> </Grid> </UserControl>