Skip to content

Commit 93f346c

Browse files
committed
Update SettingsCardAutomationPeer.cs
1 parent 50cf3e5 commit 93f346c

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

‎dev/DevWinUI.Controls/Controls/Ported/SettingsCard/SettingsCardAutomationPeer.cs‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace DevWinUI;
1010
/// <summary>
1111
/// AutomationPeer for SettingsCard
1212
/// </summary>
13-
public partial class SettingsCardAutomationPeer : FrameworkElementAutomationPeer
13+
public partial class SettingsCardAutomationPeer : ButtonBaseAutomationPeer
1414
{
1515
/// <summary>
1616
/// Initializes a new instance of the <see cref="SettingsCard"/> class.
@@ -68,4 +68,23 @@ protected override string GetNameCore()
6868

6969
return base.GetNameCore();
7070
}
71+
72+
protected override object? GetPatternCore(PatternInterface patternInterface)
73+
{
74+
if (patternInterface == PatternInterface.Invoke)
75+
{
76+
if (Owner is SettingsCard settingsCard && settingsCard.IsClickEnabled)
77+
{
78+
// Only provide Invoke pattern if the card is clickable
79+
return this;
80+
}
81+
else
82+
{
83+
// Not clickable, do not provide Invoke pattern
84+
return null;
85+
}
86+
}
87+
88+
return base.GetPatternCore(patternInterface);
89+
}
7190
}

0 commit comments

Comments
 (0)