Merge pull request #646 from irihitech/copilot/fix-645

Add ClearButton support for TextBox with TextArea and ClearButton classes
This commit is contained in:
Dong Bin
2025-07-25 17:29:43 +08:00
committed by GitHub
2 changed files with 52 additions and 11 deletions

View File

@@ -163,13 +163,15 @@
</Style>
<Style Selector="^.clearButton, ^.ClearButton">
<Style Selector="^[AcceptsReturn=False][IsReadOnly=False]:focus:not(:empty) /template/ Button#PART_ClearButton">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^[AcceptsReturn=False][IsReadOnly=False]:pointerover:not(:empty) /template/ Button#PART_ClearButton">
<Setter Property="IsVisible" Value="True" />
<Style Selector="^[AcceptsReturn=False][IsReadOnly=False]:not(:empty)">
<Style Selector="^:pointerover,^:focus">
<Style Selector="^ /template/ Button#PART_ClearButton">
<Setter Property="IsVisible" Value="True" />
</Style>
</Style>
</Style>
</Style>
<Style Selector="^.revealPasswordButton, ^.RevealPasswordButton">
<Setter Property="PasswordChar" Value="•" />
<Style Selector="^ /template/ ToggleButton#PART_RevealButton">
@@ -222,9 +224,27 @@
<Style Selector="^.TextArea">
<Setter Property="AcceptsReturn" Value="True" />
<Setter Property="VerticalContentAlignment" Value="Top" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="Padding" Value="{DynamicResource TextBoxTextAreaContentPadding}" />
<Setter Property="MinHeight" Value="{DynamicResource TextBoxTextAreaHeight}" />
<Setter Property="TextInputOptions.ReturnKeyType" Value="Return" />
<Style Selector="^.clearButton, ^.ClearButton">
<Style Selector="^ /template/ Button#PART_ClearButton">
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="IsVisible" Value="True" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="IsEnabled" Value="False" />
<Setter Property="Opacity" Value="0" />
</Style>
<Style Selector="^[IsReadOnly=False]:not(:empty)">
<Style Selector="^:pointerover,^:focus">
<Style Selector="^ /template/ Button#PART_ClearButton">
<Setter Property="IsEnabled" Value="True" />
<Setter Property="Opacity" Value="1" />
</Style>
</Style>
</Style>
</Style>
</Style>
</ControlTheme>
@@ -371,13 +391,15 @@
</Style>
<Style Selector="^.clearButton, ^.ClearButton">
<Style Selector="^[AcceptsReturn=False][IsReadOnly=False]:focus:not(:empty) /template/ Button#PART_ClearButton">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^[AcceptsReturn=False][IsReadOnly=False]:pointerover:not(:empty) /template/ Button#PART_ClearButton">
<Setter Property="IsVisible" Value="True" />
<Style Selector="^[AcceptsReturn=False][IsReadOnly=False]:not(:empty)">
<Style Selector="^:pointerover,^:focus">
<Style Selector="^ /template/ Button#PART_ClearButton">
<Setter Property="IsVisible" Value="True" />
</Style>
</Style>
</Style>
</Style>
<Style Selector="^.revealPasswordButton, ^.RevealPasswordButton">
<Setter Property="PasswordChar" Value="•" />
<Style Selector="^ /template/ ToggleButton#PART_RevealButton">
@@ -430,9 +452,27 @@
<Style Selector="^.TextArea">
<Setter Property="AcceptsReturn" Value="True" />
<Setter Property="VerticalContentAlignment" Value="Top" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="Padding" Value="{DynamicResource TextBoxTextAreaContentPadding}" />
<Setter Property="MinHeight" Value="{DynamicResource TextBoxTextAreaHeight}" />
<Setter Property="TextInputOptions.ReturnKeyType" Value="Return" />
<Style Selector="^.clearButton, ^.ClearButton">
<Style Selector="^ /template/ Button#PART_ClearButton">
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="IsVisible" Value="True" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="IsEnabled" Value="False" />
<Setter Property="Opacity" Value="0" />
</Style>
<Style Selector="^[IsReadOnly=False]:not(:empty)">
<Style Selector="^:pointerover,^:focus">
<Style Selector="^ /template/ Button#PART_ClearButton">
<Setter Property="IsEnabled" Value="True" />
<Setter Property="Opacity" Value="1" />
</Style>
</Style>
</Style>
</Style>
</Style>
</ControlTheme>
@@ -548,4 +588,4 @@
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>