feat(ui-visuals): add Visuals.xaml styles and merge them into the theme
Card list and container styles, SequenceCard, PreviewViewport, SegmentedControl and SplitButton templates, focus visuals for the drawn controls; Controls.xaml merges the dictionary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
2 files changed
+299
No files matched your search
@@ -9,6 +9,7 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Titano.Ui;component/Themes/Typography.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/Titano.Ui;component/Icons/Icons.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/Titano.Ui;component/Themes/Visuals.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
|
||||
@@ -0,0 +1,298 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="clr-namespace:Titano.Ui.Controls"
|
||||
xmlns:v="clr-namespace:Titano.Ui.Visuals">
|
||||
<!--
|
||||
Styles of the high-performance visuals (Titano.Ui.Visuals), merged by Controls.xaml. Brushes and the shared
|
||||
button templates of Controls.xaml are DynamicResource (they live in the parent dictionary); sizes, radii and
|
||||
fonts are StaticResource from Typography.xaml, merged here so they resolve while this dictionary loads.
|
||||
-->
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Titano.Ui;component/Themes/Typography.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<!-- ===================== Library grid: card container and list ===================== -->
|
||||
<Style x:Key="ListBoxItem.Card" TargetType="ListBoxItem">
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource Focus.Ring}" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="MinHeight" Value="0" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBoxItem">
|
||||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Virtualized, recycling card grid (BRIEF §12.2). Item template: a v:SequenceCard bound to the item. -->
|
||||
<Style x:Key="ListBox.Cards" TargetType="ListBox">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="SelectionMode" Value="Extended" />
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
||||
<Setter Property="ScrollViewer.PanningMode" Value="VerticalOnly" />
|
||||
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
|
||||
<Setter Property="VirtualizingPanel.VirtualizationMode" Value="Recycling" />
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource ListBoxItem.Card}" />
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<v:VirtualizingWrapPanel Padding="20,4,20,12" />
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- ===================== Sequence card (DESIGN §4 Cards) ===================== -->
|
||||
<DataTemplate x:Key="Template.CardStatus" DataType="{x:Type v:CardStatus}">
|
||||
<ui:StatusGlyph Kind="{Binding Kind}" Text="{Binding Text}" ToolTip="{Binding ToolTip}" Margin="0,0,8,0" />
|
||||
</DataTemplate>
|
||||
|
||||
<Style TargetType="v:SequenceCard">
|
||||
<Setter Property="Width" Value="236" />
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Card}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Stroke}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
|
||||
<Setter Property="FontFamily" Value="{StaticResource Font.Ui}" />
|
||||
<Setter Property="FontSize" Value="{StaticResource Size.Body}" />
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Title, RelativeSource={RelativeSource Self}}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="v:SequenceCard">
|
||||
<Grid>
|
||||
<Border x:Name="Glow" Margin="-3" CornerRadius="11" BorderThickness="3" BorderBrush="{DynamicResource Brush.AccentSelected}" Visibility="Collapsed" />
|
||||
<Border x:Name="Frame" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1"
|
||||
CornerRadius="{StaticResource Radius.Card}">
|
||||
<StackPanel>
|
||||
<v:AspectRatioDecorator>
|
||||
<Grid x:Name="PART_Thumbnail" Background="Transparent">
|
||||
<Border CornerRadius="7,7,0,0" Background="{DynamicResource Brush.Preview}" />
|
||||
<Border CornerRadius="7,7,0,0">
|
||||
<Border.Background>
|
||||
<ImageBrush ImageSource="{Binding DisplayedThumbnail, RelativeSource={RelativeSource TemplatedParent}}" Stretch="UniformToFill" />
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<Border x:Name="ScrubTrack" Height="2" VerticalAlignment="Bottom" Background="{DynamicResource Brush.Accent}" RenderTransformOrigin="0,0.5" Visibility="Collapsed">
|
||||
<Border.RenderTransform>
|
||||
<ScaleTransform ScaleX="{Binding ScrubPosition, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</Border.RenderTransform>
|
||||
</Border>
|
||||
<CheckBox x:Name="Select" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="8" Focusable="False" Visibility="Collapsed"
|
||||
IsChecked="{Binding IsSelected, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" ToolTip="{TemplateBinding SelectToolTip}" />
|
||||
<Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="8"
|
||||
Visibility="{Binding Badge, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ui:NullToCollapsedConverter.Instance}}">
|
||||
<Border Background="{DynamicResource Brush.Chrome}" Opacity="0.85" CornerRadius="4" />
|
||||
<TextBlock Text="{TemplateBinding Badge}" Margin="6,2" FontSize="{StaticResource Size.Chip}" Typography.NumeralAlignment="Tabular" />
|
||||
</Grid>
|
||||
<ContentPresenter x:Name="Actions" Content="{TemplateBinding ActionsContent}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="8" Visibility="Collapsed" />
|
||||
</Grid>
|
||||
</v:AspectRatioDecorator>
|
||||
<StackPanel Margin="10,8,10,8">
|
||||
<TextBlock Text="{TemplateBinding Title}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Text="{TemplateBinding Subtitle}" Margin="0,4,0,0" FontSize="{StaticResource Size.Secondary}" Foreground="{DynamicResource Brush.TextMuted}"
|
||||
TextTrimming="CharacterEllipsis" Typography.NumeralAlignment="Tabular" />
|
||||
<ItemsControl ItemsSource="{TemplateBinding Statuses}" ItemTemplate="{StaticResource Template.CardStatus}" Margin="0,4,0,0" Focusable="False">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Select" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="Actions" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="Frame" Property="BorderBrush" Value="{DynamicResource Brush.StrokeStrong}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsScrubbing" Value="True">
|
||||
<Setter TargetName="ScrubTrack" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Select" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="Frame" Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||
<Setter TargetName="Glow" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.4" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- ===================== Focusable drawn visuals ===================== -->
|
||||
<Style TargetType="v:Filmstrip">
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource Focus.Ring}" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="v:CurveEditor">
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource Focus.Ring}" />
|
||||
</Style>
|
||||
|
||||
<!-- ===================== Preview viewport (BRIEF §12.3) ===================== -->
|
||||
<Style TargetType="v:PreviewViewport">
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Preview}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
|
||||
<Setter Property="FontFamily" Value="{StaticResource Font.Ui}" />
|
||||
<Setter Property="FontSize" Value="{StaticResource Size.Secondary}" />
|
||||
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="v:PreviewViewport">
|
||||
<Border Background="{TemplateBinding Background}" CornerRadius="{StaticResource Radius.Card}">
|
||||
<Grid>
|
||||
<v:PreviewSurface x:Name="PART_Surface" CornerRadius="8" />
|
||||
<ContentPresenter Content="{TemplateBinding ToolsContent}" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="12" />
|
||||
<Grid x:Name="Info" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="12" IsHitTestVisible="False">
|
||||
<Border Background="{DynamicResource Brush.Chrome}" Opacity="0.85" CornerRadius="{StaticResource Radius.Control}" />
|
||||
<TextBlock Text="{TemplateBinding InfoText}" Margin="10,6" Typography.NumeralAlignment="Tabular" TextTrimming="CharacterEllipsis" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="InfoText" Value="{x:Null}">
|
||||
<Setter TargetName="Info" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="InfoText" Value="">
|
||||
<Setter TargetName="Info" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- ===================== Segmented control (Library view switcher) ===================== -->
|
||||
<Style TargetType="v:SegmentedControl">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="v:SegmentedControl">
|
||||
<StackPanel Orientation="Horizontal" IsItemsHost="True" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="v:SegmentedItem">
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource Focus.Ring}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Card}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Stroke}" />
|
||||
<Setter Property="FontFamily" Value="{StaticResource Font.Ui}" />
|
||||
<Setter Property="FontSize" Value="{StaticResource Size.Body}" />
|
||||
<Setter Property="Height" Value="{StaticResource Height.Control}" />
|
||||
<Setter Property="MinWidth" Value="32" />
|
||||
<Setter Property="Padding" Value="8,0" />
|
||||
<Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="v:SegmentedItem">
|
||||
<Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1"
|
||||
CornerRadius="{StaticResource Radius.Control}" SnapsToDevicePixels="True">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="{TemplateBinding Padding}">
|
||||
<ui:Icon x:Name="Glyph" Glyph="{TemplateBinding Glyph}" VerticalAlignment="Center" />
|
||||
<ContentPresenter x:Name="Content" Margin="6,0,0,0" VerticalAlignment="Center" RecognizesAccessKey="True" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Position" Value="First">
|
||||
<Setter TargetName="Bd" Property="CornerRadius" Value="6,0,0,6" />
|
||||
</Trigger>
|
||||
<Trigger Property="Position" Value="Middle">
|
||||
<Setter TargetName="Bd" Property="CornerRadius" Value="0" />
|
||||
<Setter Property="Margin" Value="-1,0,0,0" />
|
||||
</Trigger>
|
||||
<Trigger Property="Position" Value="Last">
|
||||
<Setter TargetName="Bd" Property="CornerRadius" Value="0,6,6,0" />
|
||||
<Setter Property="Margin" Value="-1,0,0,0" />
|
||||
</Trigger>
|
||||
<Trigger Property="Glyph" Value="{x:Null}">
|
||||
<Setter TargetName="Glyph" Property="Visibility" Value="Collapsed" />
|
||||
<Setter TargetName="Content" Property="Margin" Value="0" />
|
||||
</Trigger>
|
||||
<Trigger Property="Content" Value="{x:Null}">
|
||||
<Setter TargetName="Content" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource Brush.CardHover}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource Brush.AccentSubtle}" />
|
||||
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Accent}" />
|
||||
<Setter Property="Panel.ZIndex" Value="1" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.4" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- ===================== Split button (Render ▾) ===================== -->
|
||||
<Style x:Key="SplitButton.ArrowPrimary" TargetType="ToggleButton">
|
||||
<Setter Property="Template" Value="{DynamicResource Template.Button}" />
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource Focus.Ring}" />
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Accent}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.AccentPressed}" />
|
||||
<Setter Property="BorderThickness" Value="1,0,0,0" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.OnAccent}" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="ui:ControlState.HoverBackground" Value="{DynamicResource Brush.AccentHover}" />
|
||||
<Setter Property="ui:ControlState.HoverBorderBrush" Value="{DynamicResource Brush.AccentPressed}" />
|
||||
<Setter Property="ui:ControlState.PressedBackground" Value="{DynamicResource Brush.AccentPressed}" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="v:SplitButton">
|
||||
<Setter Property="Height" Value="{StaticResource Height.Control}" />
|
||||
<Setter Property="FontFamily" Value="{StaticResource Font.Ui}" />
|
||||
<Setter Property="FontSize" Value="{StaticResource Size.Body}" />
|
||||
<Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="v:SplitButton">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button x:Name="Main" Style="{DynamicResource Button.Base}" Height="{TemplateBinding Height}" ui:ControlState.CornerRadius="6,0,0,6"
|
||||
Content="{TemplateBinding Content}" Command="{TemplateBinding Command}" CommandParameter="{TemplateBinding CommandParameter}"
|
||||
CommandTarget="{TemplateBinding CommandTarget}" />
|
||||
<ToggleButton x:Name="Arrow" Style="{DynamicResource Button.Base}" Height="{TemplateBinding Height}" Width="28" MinWidth="28" Padding="0" Margin="-1,0,0,0"
|
||||
ClickMode="Press" ui:ControlState.CornerRadius="0,6,6,0" ui:ButtonIcon.Glyph="{DynamicResource Icon.ChevronDown}"
|
||||
IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" ToolTip="{TemplateBinding DropDownToolTip}" />
|
||||
</StackPanel>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsPrimary" Value="True">
|
||||
<Setter TargetName="Main" Property="Style" Value="{DynamicResource Button.Primary}" />
|
||||
<Setter TargetName="Arrow" Property="Style" Value="{StaticResource SplitButton.ArrowPrimary}" />
|
||||
<Setter TargetName="Arrow" Property="Margin" Value="0" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
Reference in new issue
Block a user