Compare commits

...

13 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
6c8f3a4772 Implement parent culture fallback for OverrideLocaleResources
Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>
2025-07-28 15:18:47 +00:00
copilot-swe-agent[bot]
8ac1e010a3 Initial plan 2025-07-28 15:05:58 +00:00
Dong Bin
985ad0c637 Merge pull request #646 from irihitech/copilot/fix-645
Add ClearButton support for TextBox with TextArea and ClearButton classes
2025-07-25 17:29:43 +08:00
Zhang Dian
59576d4cfd fix: enhance ClearButton visibility and functionality in TextArea styles. 2025-07-25 17:12:30 +08:00
copilot-swe-agent[bot]
c2a072041d Remove AcceptsReturn=False condition and add TextArea ClearButton top alignment
Co-authored-by: zdpcdt <54255897+zdpcdt@users.noreply.github.com>
2025-07-25 06:43:39 +00:00
Zhang Dian
a62655d25a Merge pull request #644 from irihitech/copilot/fix-622
Add InheritsTransform property to all popup controls for consistent transform behavior
2025-07-25 14:38:32 +08:00
copilot-swe-agent[bot]
2d2f2afec1 Add ClearButton support for TextArea with ClearButton class combination
Co-authored-by: zdpcdt <54255897+zdpcdt@users.noreply.github.com>
2025-07-25 06:10:49 +00:00
copilot-swe-agent[bot]
1f02f28f8b Add InheritsTransform="True" to all popup controls for consistent transform behavior
Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>
2025-07-25 06:09:02 +00:00
copilot-swe-agent[bot]
ec2202e2ef Initial plan 2025-07-25 06:01:15 +00:00
copilot-swe-agent[bot]
68dfaa8a57 Initial plan 2025-07-25 05:55:04 +00:00
Zhang Dian
16a8d6b37d Merge pull request #643 from irihitech/copilot/fix-642
Set TextInputOptions.ReturnKeyType="Return" as default for TextArea controls
2025-07-25 13:46:51 +08:00
copilot-swe-agent[bot]
6d0f3526a9 Add TextInputOptions.ReturnKeyType="Return" default to TextArea styles
Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>
2025-07-25 03:58:58 +00:00
copilot-swe-agent[bot]
e5822ff6d1 Initial plan 2025-07-25 03:40:21 +00:00
8 changed files with 111 additions and 14 deletions

View File

@@ -48,6 +48,7 @@
IsEnabled="False" />
</StackPanel>
<TextBox Width="300" Classes="TextArea" Watermark="TextArea TextBox" />
<TextBox Width="300" Classes="TextArea ClearButton" Text="TextArea with ClearButton - text should be clearable" />
<TextBox
Width="300"
Theme="{StaticResource LooklessTextBox}"

View File

@@ -28,6 +28,7 @@
<Popup
Name="PART_Popup"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
InheritsTransform="True"
IsLightDismissEnabled="True"
PlacementTarget="{TemplateBinding}">
<Border
@@ -67,6 +68,7 @@
<Popup
Name="PART_Popup"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
InheritsTransform="True"
IsLightDismissEnabled="True"
PlacementTarget="{TemplateBinding}">
<Border

View File

@@ -96,6 +96,7 @@
<Popup
Name="PART_Popup"
Grid.Column="0"
InheritsTransform="True"
IsLightDismissEnabled="True"
Placement="BottomEdgeAlignedLeft"
PlacementTarget="{TemplateBinding}">

View File

@@ -226,6 +226,7 @@
Name="PART_Popup"
Grid.Column="0"
Grid.ColumnSpan="2"
InheritsTransform="True"
IsLightDismissEnabled="True"
Placement="Bottom"
PlacementTarget="{TemplateBinding}"

View File

@@ -191,6 +191,7 @@
<Popup
Name="PART_Popup"
HorizontalOffset="-8"
InheritsTransform="True"
IsLightDismissEnabled="False"
IsOpen="{TemplateBinding IsSubMenuOpen,
Mode=TwoWay}"
@@ -326,6 +327,7 @@
Name="PART_Popup"
MinWidth="{Binding $parent[MenuItem].Bounds.Width}"
HorizontalOffset="-8"
InheritsTransform="True"
IsLightDismissEnabled="True"
IsOpen="{TemplateBinding IsSubMenuOpen,Mode=TwoWay}"
OverlayInputPassThroughElement="{Binding $parent[Menu]}"

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,8 +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>
@@ -370,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">
@@ -429,8 +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>
@@ -546,4 +588,4 @@
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -291,6 +291,7 @@
Name="PART_Popup"
Grid.Column="0"
Grid.ColumnSpan="2"
InheritsTransform="True"
IsLightDismissEnabled="True"
Placement="Bottom"
PlacementTarget="{TemplateBinding}"

View File

@@ -46,7 +46,7 @@ public class SemiTheme : Styles
{
try
{
if (TryGetLocaleResource(value, out var resource) && resource is not null)
if (TryGetLocaleResource(value, false, out var resource) && resource is not null)
{
_locale = value;
foreach (var kv in resource) Resources[kv.Key] = kv.Value;
@@ -65,6 +65,11 @@ public class SemiTheme : Styles
}
private static bool TryGetLocaleResource(CultureInfo? locale, out ResourceDictionary? resourceDictionary)
{
return TryGetLocaleResource(locale, false, out resourceDictionary);
}
private static bool TryGetLocaleResource(CultureInfo? locale, bool enableParentCultureFallback, out ResourceDictionary? resourceDictionary)
{
if (Equals(locale, CultureInfo.InvariantCulture))
{
@@ -78,20 +83,56 @@ public class SemiTheme : Styles
return false;
}
// Try exact match first
if (_localeToResource.TryGetValue(locale, out var resource))
{
resourceDictionary = resource;
return true;
}
// If enabled, try to find a culture that has this locale as parent or that shares the same parent
if (enableParentCultureFallback)
{
// Look for any supported culture that has this locale as its parent
foreach (var supportedCulture in _localeToResource.Keys)
{
if (Equals(supportedCulture.Parent, locale))
{
resourceDictionary = _localeToResource[supportedCulture];
return true;
}
}
// If this locale has a parent (and it's not invariant), try to find
// a supported culture that shares the same parent
var targetParent = locale.Parent;
if (!Equals(targetParent, CultureInfo.InvariantCulture))
{
foreach (var supportedCulture in _localeToResource.Keys)
{
if (Equals(supportedCulture.Parent, targetParent))
{
resourceDictionary = _localeToResource[supportedCulture];
return true;
}
}
}
}
resourceDictionary = _defaultResource;
return false;
}
public static void OverrideLocaleResources(Application application, CultureInfo? culture)
{
OverrideLocaleResources(application, culture, false);
}
public static void OverrideLocaleResources(Application application, CultureInfo? culture, bool enableParentCultureFallback)
{
if (culture is null) return;
if (!_localeToResource.TryGetValue(culture, out var resources)) return;
if (!TryGetLocaleResource(culture, enableParentCultureFallback, out var resources)) return;
if (resources is null) return;
foreach (var kv in resources)
{
application.Resources[kv.Key] = kv.Value;
@@ -99,9 +140,15 @@ public class SemiTheme : Styles
}
public static void OverrideLocaleResources(StyledElement element, CultureInfo? culture)
{
OverrideLocaleResources(element, culture, false);
}
public static void OverrideLocaleResources(StyledElement element, CultureInfo? culture, bool enableParentCultureFallback)
{
if (culture is null) return;
if (!_localeToResource.TryGetValue(culture, out var resources)) return;
if (!TryGetLocaleResource(culture, enableParentCultureFallback, out var resources)) return;
if (resources is null) return;
foreach (var kv in resources)
{
element.Resources[kv.Key] = kv.Value;