File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
components/SettingsControls/src/SettingsCard Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ namespace CommunityToolkit.WinUI.Controls;
77/// <summary>
88/// AutomationPeer for SettingsCard
99/// </summary>
10- public partial class SettingsCardAutomationPeer : FrameworkElementAutomationPeer
10+ public partial class SettingsCardAutomationPeer : ButtonBaseAutomationPeer
1111{
1212 /// <summary>
1313 /// Initializes a new instance of the <see cref="SettingsCard"/> class.
@@ -66,4 +66,24 @@ protected override string GetNameCore()
6666
6767 return base . GetNameCore ( ) ;
6868 }
69+
70+ /// <inheritdoc/>
71+ protected override object ? GetPatternCore ( PatternInterface patternInterface )
72+ {
73+ if ( patternInterface == PatternInterface . Invoke )
74+ {
75+ if ( Owner is SettingsCard settingsCard && settingsCard . IsClickEnabled )
76+ {
77+ // Only provide Invoke pattern if the card is clickable
78+ return this ;
79+ }
80+ else
81+ {
82+ // Not clickable, do not provide Invoke pattern
83+ return null ;
84+ }
85+ }
86+
87+ return base . GetPatternCore ( patternInterface ) ;
88+ }
6989}
You can’t perform that action at this time.
0 commit comments