Files
Semi.Avalonia/src/Semi.Avalonia/Controls/SelectableTextBlock.axaml
Zhang Dian 0ced8e62a6 misc: clean prefix Control.
(cherry picked from commit fd68cad375)
2024-12-02 17:12:43 +08:00

91 lines
4.3 KiB
XML

<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True">
<MenuFlyout x:Key="SelectableTextBlockContextFlyout" Placement="Bottom">
<MenuItem
x:Name="SelectableTextBlockContextFlyoutCopyItem"
Command="{Binding $parent[SelectableTextBlock].Copy}"
Header="{DynamicResource STRING_MENU_COPY}"
InputGesture="{x:Static TextBox.CopyGesture}"
IsEnabled="{Binding $parent[SelectableTextBlock].CanCopy}" />
</MenuFlyout>
<ControlTheme x:Key="{x:Type SelectableTextBlock}" TargetType="SelectableTextBlock">
<Setter Property="Foreground" Value="{DynamicResource TextBlockDefaultForeground}" />
<Setter Property="FontSize" Value="{DynamicResource TextBlockFontSize}" />
<Setter Property="Cursor" Value="Ibeam" />
<Setter Property="SelectionBrush" Value="{DynamicResource TextBlockSelectionBackground}" />
<Setter Property="SelectionForegroundBrush" Value="{DynamicResource TextBlockSelectionForeground}" />
<Style Selector="^.Secondary">
<Setter Property="Foreground" Value="{DynamicResource TextBlockSecondaryForeground}" />
</Style>
<Style Selector="^.Tertiary">
<Setter Property="Foreground" Value="{DynamicResource TextBlockTertiaryForeground}" />
</Style>
<Style Selector="^.Quaternary">
<Setter Property="Foreground" Value="{DynamicResource TextBlockQuaternaryForeground}" />
</Style>
<Style Selector="^.Success">
<Setter Property="Foreground" Value="{DynamicResource TextBlockSuccessForeground}" />
</Style>
<Style Selector="^.Warning">
<Setter Property="Foreground" Value="{DynamicResource TextBlockWarningForeground}" />
</Style>
<Style Selector="^.Danger">
<Setter Property="Foreground" Value="{DynamicResource TextBlockDangerForeground}" />
</Style>
<Style Selector="^.Mark">
<Setter Property="Background" Value="{DynamicResource TextBlockMarkBackground}" />
</Style>
<Style Selector="^.Underline">
<Setter Property="TextDecorations" Value="Underline" />
</Style>
<Style Selector="^.Delete">
<Setter Property="TextDecorations" Value="StrikeThrough" />
</Style>
<Style Selector="^.Underline.Delete">
<Setter Property="TextDecorations">
<TextDecorationCollection>
<TextDecoration Location="Underline" />
<TextDecoration Location="Strikethrough" />
</TextDecorationCollection>
</Setter>
</Style>
<Style Selector="^:disabled">
<Setter Property="Foreground" Value="{DynamicResource TextBlockDisabledForeground}" />
</Style>
<Style Selector="^[IsEnabled=True]">
<Setter Property="ContextFlyout" Value="{StaticResource SelectableTextBlockContextFlyout}" />
</Style>
</ControlTheme>
<ControlTheme
x:Key="TitleSelectableTextBlock"
BasedOn="{StaticResource {x:Type SelectableTextBlock}}"
TargetType="SelectableTextBlock">
<Setter Property="SelectableTextBlock.FontWeight" Value="{DynamicResource TextBlockTitleFontWeight}" />
<Style Selector="^.H1">
<Setter Property="FontSize" Value="{DynamicResource TextBlockTitleH1FontSize}" />
</Style>
<Style Selector="^.H2">
<Setter Property="FontSize" Value="{DynamicResource TextBlockTitleH2FontSize}" />
</Style>
<Style Selector="^.H3">
<Setter Property="FontSize" Value="{DynamicResource TextBlockTitleH3FontSize}" />
</Style>
<Style Selector="^.H4">
<Setter Property="FontSize" Value="{DynamicResource TextBlockTitleH4FontSize}" />
</Style>
<Style Selector="^.H5">
<Setter Property="FontSize" Value="{DynamicResource TextBlockTitleH5FontSize}" />
</Style>
<Style Selector="^.H6">
<Setter Property="FontSize" Value="{DynamicResource TextBlockTitleH6FontSize}" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Foreground" Value="{DynamicResource TextBlockDisabledForeground}" />
</Style>
</ControlTheme>
</ResourceDictionary>