Skip to content

Commit 659b1bb

Browse files
committed
chore: resolve PR comments
1 parent 7c1ec70 commit 659b1bb

File tree

2 files changed

+36
-39
lines changed

2 files changed

+36
-39
lines changed

src/Uno.Toolkit.UI/Behaviors/InputExtensions.cs

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -25,50 +25,63 @@
2525
using Windows.UI.Xaml.Input;
2626
#endif
2727

28+
#if !HAS_UNO_WINUI
29+
namespace Uno.Toolkit.UI
30+
{
31+
32+
// Dummy enum for Uno.UI v5 so ReturnType DP compiles as InputReturnType is available for v6+.
33+
public enum InputReturnType
34+
{
35+
Default,
36+
Done,
37+
Go,
38+
Next,
39+
Search,
40+
Send
41+
}
42+
}
43+
#endif
44+
2845
namespace Uno.Toolkit.UI
2946
{
3047
public static class InputExtensions
3148
{
3249
private static readonly ILogger _logger = typeof(InputExtensions).Log();
50+
3351
#region DependencyProperty: ReturnType
3452

35-
#if HAS_UNO_WINUI
3653
/// <summary>
3754
/// Backing property for what type of return the soft keyboard will show.
3855
/// </summary>
39-
public static DependencyProperty ReturnTypeProperty { get; } =
40-
DependencyProperty.RegisterAttached(
56+
public static DependencyProperty ReturnTypeProperty { [DynamicDependency(nameof(GetReturnType))] get; } = DependencyProperty.RegisterAttached(
4157
"ReturnType",
4258
typeof(InputReturnType),
4359
typeof(InputExtensions),
4460
new PropertyMetadata(InputReturnType.Default, OnReturnTypeChanged));
4561

46-
public static InputReturnType GetReturnType(DependencyObject obj) =>
47-
(InputReturnType)obj.GetValue(ReturnTypeProperty);
62+
[DynamicDependency(nameof(SetReturnType))]
63+
public static InputReturnType GetReturnType(DependencyObject obj) => (InputReturnType)obj.GetValue(ReturnTypeProperty);
64+
[DynamicDependency(nameof(GetReturnType))]
65+
public static void SetReturnType(DependencyObject obj, InputReturnType value) => obj.SetValue(ReturnTypeProperty, value);
4866

49-
public static void SetReturnType(DependencyObject obj, InputReturnType value) =>
50-
obj.SetValue(ReturnTypeProperty, value);
67+
#endregion
5168

5269
private static void OnReturnTypeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
5370
{
71+
#if HAS_UNO_WINUI
5472
if (sender is TextBox || sender is PasswordBox)
5573
{
5674
TextBoxExtensions.SetInputReturnType(sender, (InputReturnType)e.NewValue);
5775
}
58-
}
5976
#endif
77+
}
6078

61-
#endregion
6279
#region DependencyProperty: AutoDismiss
6380

64-
/// <summary>
65-
/// Backing property for whether the soft keyboard will be dismissed when the enter key is pressed.
66-
/// </summary>
67-
public static DependencyProperty AutoDismissProperty
68-
{
69-
[DynamicDependency(nameof(GetAutoDismiss))]
70-
get;
71-
} = DependencyProperty.RegisterAttached(
81+
/// <summary>
82+
/// Backing property for whether the soft keyboard will be dismissed when the enter key is pressed.
83+
/// </summary>
84+
public static DependencyProperty AutoDismissProperty { [DynamicDependency(nameof(GetAutoDismiss))] get; } = DependencyProperty.RegisterAttached(
7285
"AutoDismiss",
7386
typeof(bool),
7487
typeof(InputExtensions),
@@ -89,22 +102,16 @@ public static DependencyProperty AutoDismissProperty
89102
/// Having either or both of the <see cref="AutoFocusNextProperty"/> and <see cref="AutoFocusNextElementProperty"/> set will enable the focus next behavior.
90103
/// AutoFocusNextElement will take precedences over AutoFocusNext when both are set.
91104
/// </remarks>
92-
public static DependencyProperty AutoFocusNextProperty
93-
{
94-
[DynamicDependency(nameof(GetAutoFocusNext))]
95-
get;
96-
} = DependencyProperty.RegisterAttached(
105+
public static DependencyProperty AutoFocusNextProperty { [DynamicDependency(nameof(GetAutoFocusNext))] get; } = DependencyProperty.RegisterAttached(
97106
"AutoFocusNext",
98107
typeof(bool),
99108
typeof(InputExtensions),
100109
new PropertyMetadata(default(bool), OnAutoFocusNextChanged));
101110

102111
[DynamicDependency(nameof(SetAutoFocusNext))]
103112
public static bool GetAutoFocusNext(DependencyObject obj) => (bool)obj.GetValue(AutoFocusNextProperty);
104-
105113
[DynamicDependency(nameof(GetAutoFocusNext))]
106-
public static void SetAutoFocusNext(DependencyObject obj, bool value) =>
107-
obj.SetValue(AutoFocusNextProperty, value);
114+
public static void SetAutoFocusNext(DependencyObject obj, bool value) => obj.SetValue(AutoFocusNextProperty, value);
108115

109116
#endregion
110117
#region DependencyProperty: AutoFocusNextElement
@@ -116,23 +123,16 @@ public static void SetAutoFocusNext(DependencyObject obj, bool value) =>
116123
/// Having either or both of the <see cref="AutoFocusNextProperty"/> and <see cref="AutoFocusNextElementProperty"/> set will enable the focus next behavior.
117124
/// AutoFocusNextElement will take precedences over AutoFocusNext when both are set.
118125
/// </remarks>
119-
public static DependencyProperty AutoFocusNextElementProperty
120-
{
121-
[DynamicDependency(nameof(GetAutoFocusNextElement))]
122-
get;
123-
} = DependencyProperty.RegisterAttached(
126+
public static DependencyProperty AutoFocusNextElementProperty { [DynamicDependency(nameof(GetAutoFocusNextElement))] get; } = DependencyProperty.RegisterAttached(
124127
"AutoFocusNextElement",
125128
typeof(DependencyObject),
126129
typeof(InputExtensions),
127130
new PropertyMetadata(default(Control), OnAutoFocusNextElementChanged));
128131

129132
[DynamicDependency(nameof(SetAutoFocusNextElement))]
130-
public static Control GetAutoFocusNextElement(DependencyObject obj) =>
131-
(Control)obj.GetValue(AutoFocusNextElementProperty);
132-
133+
public static Control GetAutoFocusNextElement(DependencyObject obj) => (Control)obj.GetValue(AutoFocusNextElementProperty);
133134
[DynamicDependency(nameof(GetAutoFocusNextElement))]
134-
public static void SetAutoFocusNextElement(DependencyObject obj, Control value) =>
135-
obj.SetValue(AutoFocusNextElementProperty, value);
135+
public static void SetAutoFocusNextElement(DependencyObject obj, Control value) => obj.SetValue(AutoFocusNextElementProperty, value);
136136

137137
#endregion
138138
#if false // The property is now forwarded from CommandExtensions.Command
@@ -160,13 +160,10 @@ internal static bool IsEnterCommandSupportedFor(DependencyObject host)
160160

161161
private static void OnAutoDismissChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
162162
=> UpdateSubscription(sender);
163-
164163
private static void OnAutoFocusNextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
165164
=> UpdateSubscription(sender);
166-
167165
private static void OnAutoFocusNextElementChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
168166
=> UpdateSubscription(sender);
169-
170167
internal static void OnEnterCommandChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
171168
=> UpdateSubscription(sender);
172169

src/Uno.Toolkit.UI/Controls/ExtendedSplashScreen/ExtendedSplashScreen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ internal object SplashScreenContent
5858
protected static ExtendedSplashScreen? Instance { get; private set; }
5959

6060
public
61-
#if __IOS__ || __MACOS__ // hides UIView.Window and NSView.Window
61+
#if __IOS__ || (__MACOS__ && !HAS_UNO_WINUI) // hides UIView.Window and NSView.Window
6262
new
6363
#endif
6464
Window? Window

0 commit comments

Comments
 (0)