feat: add avalonia SelectableTextBlock style.
This commit is contained in:
1 parent
a4893416cb
commit
e169600f23
2 files changed
+28
No files matched your search
@@ -53,6 +53,7 @@
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ComboBox.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Menu.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ContextMenu.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/SelectableTextBlock.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Styles.Resources>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:ClassModifier="internal">
|
||||
|
||||
<MenuFlyout x:Key="SelectableTextBlockContextFlyout"
|
||||
Placement="Bottom">
|
||||
<MenuItem Header="Copy"
|
||||
Cursor="Arrow"
|
||||
Command="{Binding $parent[SelectableTextBlock].Copy}"
|
||||
IsEnabled="{Binding $parent[SelectableTextBlock].CanCopy}"
|
||||
InputGesture="{x:Static TextBox.CopyGesture}" />
|
||||
</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}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in new issue
Block a user