Browse Source
Merge pull request #11364 from AvaloniaUI/fix-selectiontextblock-selectionbrush-color
Use correct theme specific selection brush on SelectableTextBlock
pull/11340/head
Max Katz
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
6 additions and
2 deletions
-
samples/ControlCatalog/Pages/TextBlockPage.xaml
-
src/Avalonia.Controls/SelectableTextBlock.cs
-
src/Avalonia.Themes.Fluent/Controls/SelectableTextBlock.xaml
-
src/Avalonia.Themes.Simple/Controls/SelectableTextBlock.xaml
|
|
|
@ -118,7 +118,7 @@ |
|
|
|
</StackPanel> |
|
|
|
</Border> |
|
|
|
<Border> |
|
|
|
<SelectableTextBlock SelectionBrush="LightBlue" Margin="10" TextWrapping="Wrap"> |
|
|
|
<SelectableTextBlock Margin="10" TextWrapping="Wrap"> |
|
|
|
This <Span FontWeight="Bold">is</Span> a |
|
|
|
<Span Background="Silver" Foreground="Maroon">TextBlock</Span> |
|
|
|
with <Span TextDecorations="Underline">several</Span> |
|
|
|
|
|
|
|
@ -30,7 +30,7 @@ namespace Avalonia.Controls |
|
|
|
o => o.SelectedText); |
|
|
|
|
|
|
|
public static readonly StyledProperty<IBrush?> SelectionBrushProperty = |
|
|
|
TextBox.SelectionBrushProperty.AddOwner<SelectableTextBlock>(new(new Data.Optional<IBrush?>(Brushes.Blue))); |
|
|
|
TextBox.SelectionBrushProperty.AddOwner<SelectableTextBlock>(); |
|
|
|
|
|
|
|
public static readonly DirectProperty<SelectableTextBlock, bool> CanCopyProperty = |
|
|
|
TextBox.CanCopyProperty.AddOwner<SelectableTextBlock>(o => o.CanCopy); |
|
|
|
|
|
|
|
@ -10,6 +10,8 @@ |
|
|
|
</MenuFlyout> |
|
|
|
|
|
|
|
<ControlTheme x:Key="{x:Type SelectableTextBlock}" TargetType="SelectableTextBlock"> |
|
|
|
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" /> |
|
|
|
|
|
|
|
<Style Selector="^[IsEnabled=True]"> |
|
|
|
<Setter Property="Cursor" Value="IBeam" /> |
|
|
|
<Setter Property="ContextFlyout" Value="{StaticResource SelectableTextBlockContextFlyout}" /> |
|
|
|
|
|
|
|
@ -10,6 +10,8 @@ |
|
|
|
</MenuFlyout> |
|
|
|
|
|
|
|
<ControlTheme x:Key="{x:Type SelectableTextBlock}" TargetType="SelectableTextBlock"> |
|
|
|
<Setter Property="SelectionBrush" Value="{DynamicResource HighlightBrush}" /> |
|
|
|
|
|
|
|
<Style Selector="^[IsEnabled=True]"> |
|
|
|
<Setter Property="Cursor" Value="IBeam" /> |
|
|
|
<Setter Property="ContextFlyout" Value="{StaticResource SelectableTextBlockContextFlyout}" /> |
|
|
|
|