-
Notifications
You must be signed in to change notification settings - Fork 729
/
FeatureConfiguration.cs
846 lines (759 loc) · 33.8 KB
/
FeatureConfiguration.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Automation;
using Microsoft.UI.Xaml.Automation.Peers;
using Microsoft.UI.Xaml.Controls;
using Uno.UI.Xaml.Controls;
using System.ComponentModel;
using Microsoft.UI.Xaml.Media;
using Uno.Foundation.Logging;
namespace Uno.UI
{
public static class FeatureConfiguration
{
public static class ApiInformation
{
/// <summary>
/// Determines if runtime use of not implemented members raises an exception, or logs an error message.
/// </summary>
public static bool IsFailWhenNotImplemented
{
get => Windows.Foundation.Metadata.ApiInformation.IsFailWhenNotImplemented;
set => Windows.Foundation.Metadata.ApiInformation.IsFailWhenNotImplemented = value;
}
/// <summary>
/// Determines if runtime use of not implemented members is logged only once, or at each use.
/// </summary>
public static bool AlwaysLogNotImplementedMessages
{
get => Windows.Foundation.Metadata.ApiInformation.AlwaysLogNotImplementedMessages;
set => Windows.Foundation.Metadata.ApiInformation.AlwaysLogNotImplementedMessages = value;
}
/// <summary>
/// The message log level used when a not implemented member is used at runtime, if <see cref="IsFailWhenNotImplemented"/> is false.
/// </summary>
public static LogLevel NotImplementedLogLevel
{
get => Windows.Foundation.Metadata.ApiInformation.NotImplementedLogLevel;
set => Windows.Foundation.Metadata.ApiInformation.NotImplementedLogLevel = value;
}
}
public static class AutomationPeer
{
/// <summary>
/// Enable a mode that simplifies accessibility by automatically grouping accessible elements into top-level accessible elements. The default value is false.
/// </summary>
/// <remarks>
/// When enabled, the accessibility name of top-level accessible elements (elements that return a non-null AutomationPeer in <see cref="UIElement.OnCreateAutomationPeer()"/> and/or have <see cref="AutomationProperties.Name" /> set to a non-empty string)
/// will be an aggregate of the accessibility name of all child accessible elements.
///
/// For example, if you have a <see cref="Button"/> that contains 3 <see cref="TextBlock"/> "A" "B" "C", the accessibility name of the <see cref="Button"/> will be "A, B, C".
/// These 3 <see cref="TextBlock"/> will also be automatically excluded from accessibility focus.
///
/// This greatly facilitates accessibility, as you would need to do this manually on UWP.
///
/// A limitation of this strategy is that you can't nest interactive elements, as children of an accessible elements are excluded from accessibility focus.
/// For example, if you put a <see cref="Button"/> inside another <see cref="Button"/>, only the parent <see cref="Button"/> will be focusable.
/// This happens to match a limitation of iOS, which does this by default and forces developers to make elements as siblings instead of nesting them.
///
/// To prevent a top-level accessible element from being accessible and make its children accessibility focusable, you can set <see cref="AutomationProperties.AccessibilityViewProperty"/> to <see cref="AccessibilityView.Raw"/>.
///
/// Note: This is incompatible with the way accessibility works on UWP.
/// </remarks>
public static bool UseSimpleAccessibility { get; set; }
}
public static class ComboBox
{
/// <summary>
/// This defines the default value of the <see cref="UI.Xaml.Controls.ComboBox.DropDownPreferredPlacementProperty"/>. (cf. Remarks.)
/// </summary>
/// <remarks>
/// As this value is read only once when initializing the dependency property,
/// make sure to define it in the early stages of you application initialization,
/// before any UI related initialization (like generic styles init) and even before
/// referencing the ** type ** ComboBox in any way.
/// </remarks>
public static Uno.UI.Xaml.Controls.DropDownPlacement DefaultDropDownPreferredPlacement { get; set; } = Uno.UI.Xaml.Controls.DropDownPlacement.Auto;
#if __ANDROID__
/// <summary>
/// Gets or sets a value indicating whether the ComboBox popup should be allowed
/// to be displayed under translucent status bar on Android. Defaults to false.
/// </summary>
public static bool AllowPopupUnderTranslucentStatusBar { get; set; }
#endif
}
public static class CompositionTarget
{
/// <summary>
/// The delay between invocations of the <see cref="Microsoft.UI.Xaml.Media.CompositionTarget.Rendering"/> event, in milliseconds.
/// Lower values will increase the rate at which the event fires, at the expense of increased CPU usage.
///
/// This property is only used on WebAssembly.
/// </summary>
/// <remarks>The <see cref="Microsoft.UI.Xaml.Media.CompositionTarget.Rendering"/> event is used by Xamarin.Forms for WebAssembly for XF animations.</remarks>
public static int RenderEventThrottle { get; set; } = 30;
}
public static class ContentPresenter
{
/// <summary>
/// Enables the implicit binding Content of a ContentPresenter to the one of the TemplatedParent
/// when this one is a ContentControl.
/// It means you can put a `<ContentPresenter />` directly in the ControlTemplate and it will
/// be bound automatically to its TemplatedPatent's Content.
/// </summary>
public static bool UseImplicitContentFromTemplatedParent { get; set; }
}
public static class Control
{
/// <summary>
/// Make the default value of VerticalContentAlignment and HorizontalContentAlignment be Top/Left instead of Center/Center
/// </summary>
public static bool UseLegacyContentAlignment { get; set; }
/// <summary>
/// Enables the lazy materialization of <see cref="Microsoft.UI.Xaml.Controls.Control"/> template. This behavior
/// is not aligned with UWP, which materializes templates immediately, making x:Name controls available
/// in the constructor of a control.
/// </summary>
public static bool UseLegacyLazyApplyTemplate { get; set; }
/// <summary>
/// If the call to "OnApplyTemplate" should be deferred to mimic UWP sequence of events.
/// </summary>
/// <remarks>
/// Will never be deferred when .ApplyTemplate() is called explicitly.
/// More information there: https://github.com/unoplatform/uno/issues/3519
/// </remarks>
public static bool UseDeferredOnApplyTemplate { get; set; }
#if __ANDROID__ || __IOS__ || __MACOS__
// opt-in for iOS/Android/macOS
#else
= true;
#endif
}
public static class DataTemplateSelector
{
/// <summary>
/// When set the false (default value), a call to `SelectTemplateCore(object, DependencyObject)`
/// will be made as fallback when the `SelectTemplateCore(object)` returns null.
/// When set to true, only `SelectTemplateCore(object)` is called (Uno's legacy mode).
/// </summary>
public static bool UseLegacyTemplateSelectorOverload { get; set; }
}
public static class DependencyObject
{
/// <summary>
/// When set to true, the <see cref="DependencyObjectStore"/> will create hard references
/// instead of weak references for some highly used fields, in common cases to improve the
/// overall performance.
/// </summary>
public static bool IsStoreHardReferenceEnabled { get; set; }
= true;
}
public static class ResourceDictionary
{
/// <summary>
/// Determines whether unreferenced ResourceDictionary present in the assembly
/// are accessible from app resources.
/// </summary>
public static bool IncludeUnreferencedDictionaries { get; set; }
}
public static class Font
{
private static string _symbolsFont =
#if __WASM__ || __MACOS__ || __IOS__
"Symbols";
#else
"ms-appx:///Assets/Fonts/uno-fluentui-assets.ttf#Symbols";
#endif
/// <summary>
/// Defines the default font to be used when displaying symbols, such as in SymbolIcon. Must be invoked after App.InitializeComponent() to have an effect.
/// </summary>
public static string SymbolsFont
{
get => _symbolsFont;
set
{
_symbolsFont = value;
ResourceResolver.SetSymbolsFontFamily();
}
}
/// <summary>
/// The default font family for text when a font isn't explicitly specified (e.g. for a TextBlock)
/// </summary>
/// <remarks>
/// The default is Segoe UI, which is not available on Mac and Linux as well as browsers running on Mac and Linux.
/// So, you can change to OpenSans. For more information, see https://aka.platform.uno/feature-opensans
/// </remarks>
public static string DefaultTextFontFamily { get; set; } = "Segoe UI";
/// <summary>
/// Ignores text scale factor, resulting in a font size as dictated by the control.
/// </summary>
public static bool IgnoreTextScaleFactor { get; set; }
#if __ANDROID__ || __IOS__
/// <summary>
/// Allows the user to limit the scale factor without having to ignore it.
/// </summary>
public static float? MaximumTextScaleFactor { get; set; }
#endif
}
public static class FrameworkElement
{
#if __ANDROID__
/// <summary>
/// Controls the propagation of <see cref="Microsoft.UI.Xaml.FrameworkElement.Loaded"/> and
/// <see cref="Microsoft.UI.Xaml.FrameworkElement.Unloaded"/> events through managed
/// or native visual tree traversal.
/// </summary>
/// <remarks>
/// This setting impacts significantly the loading performance of controls on Android.
/// Setting it to true avoids the use of costly Java->C# interop.
/// </remarks>
public static bool AndroidUseManagedLoadedUnloaded { get; set; } = true;
#endif
#if __ANDROID__
/// <summary>
/// Invalidate native android measure cache when measure-spec has changed since last measure.
/// </summary>
public static bool InvalidateNativeCacheOnRemeasure { get; set; } = true;
#endif
/// <summary>
/// When false, skips the FrameworkElement Loading/Loaded/Unloaded exception handling. This can be
/// disabled to improve application performance on WebAssembly. See See #7005 for additional details.
/// </summary>
public static bool HandleLoadUnloadExceptions { get; set; } = true;
/// <summary>
/// When true, any FrameworkElement with Background non-null will intercept pointer events. When set to false, the default, only
/// certain views (Panels, Borders, and ContentPresenters) will intercept pointers if their background is non-null, while others (Control)
/// will not, which is how WinUI behaves. Set to true if you have code written for earlier versions of Uno that relies upon the old behavior.
/// </summary>
public static bool UseLegacyHitTest { get; set; }
#if __IOS__
/// <summary>
/// When true, propagate the NeedsLayout on superview even if the element is in its LayoutSubViews() (i.e. Arrange()).
/// This is known to cause a layout cycle when a child invalidates itself during arrange (e.g. ItemsRepeater).
/// Default value is false, setting it to true will restore the behavior of uno v4.7 and earlier.
/// </summary>
public static bool IOsAllowSuperviewNeedsLayoutWhileInLayoutSubViews { get; set; }
#endif
}
public static class FrameworkTemplate
{
/// <summary>
/// Determines if the pooling is enabled. If false, all requested instances are new.
/// </summary>
public static bool IsPoolingEnabled { get => FrameworkTemplatePool.IsPoolingEnabled; set => FrameworkTemplatePool.IsPoolingEnabled = value; }
/// <summary>
/// Determines the duration for which a pooled template stays alive
/// </summary>
public static TimeSpan TimeToLive { get => FrameworkTemplatePool.TimeToLive; set => FrameworkTemplatePool.TimeToLive = value; }
/// <summary>
/// Defines the ratio of memory usage at which the pools starts to stop pooling elligible views, between 0 and 1
/// </summary>
public static float HighMemoryThreshold { get => FrameworkTemplatePool.HighMemoryThreshold; set => FrameworkTemplatePool.HighMemoryThreshold = value; }
}
public static class Image
{
/// <summary>
/// Use the old way to align iOS images, using the "ContentMode".
/// New way is using the Layer to better position the image according to alignments.
/// </summary>
public static bool LegacyIosAlignment { get; set; }
}
public static class Interop
{
/// <summary>
/// [WebAssembly Only] Used to control the behavior of the C#/Javascript interop. Setting this
/// flag to true forces the use of the Javascript eval mode, instead of binary interop.
/// This flag has no effect when running in hosted mode.
/// </summary>
public static bool ForceJavascriptInterop { get; set; }
}
public static class Binding
{
/// <summary>
/// Determines if the binding engine should ignore identical references in binding paths.
/// </summary>
public static bool IgnoreINPCSameReferences { get; set; }
}
public static class BindingExpression
{
/// <summary>
/// When false, skips the BindingExpression.SetTargetValue exception handling. Can be disabled to
/// improve application performance on WebAssembly. See See #7005 for additional details.
/// </summary>
public static bool HandleSetTargetValueExceptions { get; set; } = true;
}
public static class Popup
{
#if __ANDROID__
/// <summary>
/// Use a native popup to display the popup content. Otherwise use the <see cref="PopupRoot"/>.
/// </summary>
public static bool UseNativePopup { get; set; }
#endif
/// <summary>
/// By default, light dismiss is disabled in UWP/WinUI unless
/// <see cref="Microsoft.UI.Xaml.Controls.Primitives.Popup.IsLightDismissEnabled"/> is explicitly set to true.
/// In earlier versions of Uno Platform, this property defaulted
/// to true, which was an incorrect behavior. If your code depends on this
/// legacy behavior, use this property to override it.
/// </summary>
public static bool EnableLightDismissByDefault { get; set; }
/// <summary>
/// When set to true, light dismiss UI popups will not be dismissed when the window is deactivated.
/// This is mainly useful for debugging purposes, we do not recommend using this in production code.
/// </summary>
public static bool PreventLightDismissOnWindowDeactivated { get; set; }
}
public static class ProgressRing
{
public static Uri ProgressRingAsset { get; set; } = new Uri("embedded://Uno.UI/Uno.UI.Microsoft" + /* UWP don't rename */ ".UI.Xaml.Controls.ProgressRing.ProgressRingIntdeterminate.json");
public static Uri DeterminateProgressRingAsset { get; set; } = new Uri("embedded://Uno.UI/Uno.UI.Microsoft" + /* UWP don't rename */ ".UI.Xaml.Controls.ProgressRing.ProgressRingDeterminate.json");
}
public static class ListViewBase
{
/// <summary>
/// Sets the value to use for <see cref="ItemsStackPanel.CacheLength"/> and <see cref="ItemsWrapGrid.CacheLength"/> if not set
/// explicitly in Xaml or code. Higher values will cache more views either side of the visible window, improving list scroll
/// performance at the expense of consuming more memory and taking longer to initially load. Setting this to null will leave
/// the default value at the UWP default of 4.0.
/// </summary>
public static double? DefaultCacheLength { get; set; } = 1.0;
#if __IOS__ || __ANDROID__
/// <summary>
/// Sets a flag indicating whether <see cref="Microsoft.UI.Xaml.Controls.ListViewBase.ScrollIntoView(object)"/> will be animated smoothly or instant.
/// </summary>
/// <remarks>
/// Regardless of the value set, <see cref="Uno.UI.Helpers.ListViewHelper.InstantScrollToIndex(Microsoft.UI.Xaml.Controls.ListViewBase, int)"/>
/// and <see cref="Uno.UI.Helpers.ListViewHelper.SmoothScrollToIndex(Microsoft.UI.Xaml.Controls.ListViewBase, int)"/>
/// can be used to force a specific behavior.
/// </remarks>
public static bool AnimateScrollIntoView { get; set; } = true;
#endif
}
#if __ANDROID__
public static class NativeListViewBase
{
/// <summary>
/// Sets this value to remove item animation for <see cref="UnoRecyclerView"/>. This prevents <see cref="UnoRecyclerView"/>
/// from crashing when pressured: Tmp detached view should be removed from RecyclerView before it can be recycled
/// </summary>
public static bool RemoveItemAnimator { get; set; } = true;
/// <summary>
/// Indicates if a full recycling pass should be achieved on drop (re-order) on a ListView instead of a simple layout pass.
/// </summary>
/// <remarks>
/// This flag should be kept to 'false' if you turned <see cref="RemoveItemAnimator"/> to 'false'.
/// Forcing a recycling pass with ItemAnimator is known to cause a flicker of the whole list.
/// </remarks>
public static bool ForceRecycleOnDrop { get; set; }
/// <summary>
/// Sets a value indicating whether the item snapping will be implemented by the native <see cref="AndroidX.RecyclerView.Widget.SnapHelper"/> or by Uno.
/// </summary>
public static bool UseNativeSnapHelper { get; set; } = true;
}
#endif
public static class Page
{
/// <summary>
/// Enables reuse of <see cref="Page"/> instances. Enabling can improve performance when using <see cref="Frame"/> navigation.
/// </summary>
public static bool IsPoolingEnabled { get; set; }
}
public static class Frame
{
/// <summary>
/// On non-Skia targets, Frame pools page instances to improve performance by default.
/// To follow the WinUI behavior, set this to true. Skia uses WinUI behavior by default.
/// </summary>
public static bool UseWinUIBehavior { get; set; }
#if __SKIA__
= true;
#endif
}
public static class PointerRoutedEventArgs
{
#if __ANDROID__
/// <summary>
/// Defines if the PointerPoint.Timestamp retrieved from PointerRoutedEventArgs.GetCurrentPoint(relativeTo)
/// or PointerRoutedEventArgs.GetIntermediatePoints(relativeTo) can be relative using the Android's
/// "SystemClock.uptimeMillis()" or if they must be converted into an absolute scale
/// (using the "elapsedRealtime()", cf. https://developer.android.com/reference/android/os/SystemClock).
/// Disabling it negatively impacts the performance it requires to compute the "sleep time"
/// (i.e. [real elapsed time] - [up time]) for each event (as the up time is paused when device is in deep sleep).
/// By default this is `true`.
/// </summary>
public static bool AllowRelativeTimeStamp { get; set; } = true;
#endif
}
public static class SelectorItem
{
/// <summary>
/// <para>
/// Determines if the visual states "PointerOver", "PointerOverSelected"
/// are used or not. If disabled, those states will never be activated by the selector items.
/// </para>
/// <para>The default value is `true`.</para>
/// </summary>
public static bool UseOverStates { get; set; } = true;
}
public static class Style
{
/// <summary>
/// Determines if Uno.UI should be using native styles for controls that have
/// a native counterpart. (e.g. Button, Slider, ComboBox, ...)
///
/// By default this is true.
/// </summary>
public static bool UseUWPDefaultStyles { get; set; } = true;
/// <summary>
/// Override the native styles usage per control type.
/// </summary>
/// <remarks>
/// Usage: 'UseUWPDefaultStylesOverride[typeof(Frame)] = false;' will result in the native style always being the default for Frame, irrespective
/// of the value of <see cref="UseUWPDefaultStyles"/>. This is useful when an app uses the UWP default look for most controls but the native
/// appearance/comportment for a few particular controls, or vice versa.
/// </remarks>
public static IDictionary<Type, bool> UseUWPDefaultStylesOverride { get; } = new Dictionary<Type, bool>();
/// <summary>
/// This enables native frame navigation on Android and iOS by setting related classes (<see cref="Frame"/>, <see cref="CommandBar"/>
/// and <see cref="Microsoft.UI.Xaml.Controls.AppBarButton"/>) to use their native styles.
/// </summary>
public static void ConfigureNativeFrameNavigation()
{
if (__LinkerHints.Is_Microsoft_UI_Xaml_Controls_Frame_Available)
{
SetUWPDefaultStylesOverride<Microsoft.UI.Xaml.Controls.Frame>(useUWPDefaultStyle: false);
}
if (__LinkerHints.Is_Microsoft_UI_Xaml_Controls_CommandBar_Available)
{
SetUWPDefaultStylesOverride<Microsoft.UI.Xaml.Controls.CommandBar>(useUWPDefaultStyle: false);
}
if (__LinkerHints.Is_Microsoft_UI_Xaml_Controls_AppBarButton_Available)
{
SetUWPDefaultStylesOverride<Microsoft.UI.Xaml.Controls.AppBarButton>(useUWPDefaultStyle: false);
}
}
/// <summary>
/// Override the native styles useage for control type <typeparamref name="TControl"/>.
/// </summary>
/// <typeparam name="TControl"></typeparam>
/// <param name="useUWPDefaultStyle">
/// Whether instances of <typeparamref name="TControl"/> should use the UWP default style.
/// If false, the native default style (if one exists) will be used.
/// </param>
public static void SetUWPDefaultStylesOverride<TControl>(bool useUWPDefaultStyle) where TControl : Microsoft.UI.Xaml.Controls.Control
=> UseUWPDefaultStylesOverride[typeof(TControl)] = useUWPDefaultStyle;
}
public static class TextBlock
{
/// <summary>
/// [WebAssembly Only] Determines if the measure cache is enabled.
/// </summary>
public static bool IsMeasureCacheEnabled { get; set; } = true;
}
public static class TextBox
{
/// <summary>
/// Determines if the caret is visible or not.
/// </summary>
/// <remarks>This feature is used to avoid screenshot comparisons false positives</remarks>
public static bool HideCaret { get; set; }
/// <summary>
/// Determines if a native (Gtk/Wpf) TextBox overlay should be used on the skia targets instead of the
/// Uno skia-based TextBox implementation.
/// </summary>
public static bool UseOverlayOnSkia { get; set; }
#if __ANDROID__
/// <summary>
/// The legacy <see cref="Microsoft.UI.Xaml.Controls.TextBox.InputScope"/> prevents invalid input on hardware keyboard.
/// This property defaults to <see langword="false"/> matching UWP, where InputScope only affects the keyboard layout,
/// but doesn't do any validation.
/// </summary>
/// <remarks>
/// This is available on Android only
/// </remarks>
public static bool UseLegacyInputScope { get; set; }
#endif
}
public static class ScrollViewer
{
/// <summary>
/// This defines the default value of the <see cref="Uno.UI.Xaml.Controls.ScrollViewer.UpdatesModeProperty"/>.
/// For backward compatibility, you should set it to Synchronous.
/// For better compatibility with Windows, you should keep the default value 'AsynchronousIdle'.
/// </summary>
/// <remarks>
/// As this value is read only once when initializing the dependency property,
/// make sure to define it in the early stages of you application initialization,
/// before any UI related initialization (like generic styles init) and even before
/// referencing the ** type ** ScrollViewer in any way.
/// </remarks>
public static ScrollViewerUpdatesMode DefaultUpdatesMode { get; set; } = ScrollViewerUpdatesMode.AsynchronousIdle;
/// <summary>
/// Defines the delay after which the scrollbars hide themselves when pointer is not over.<br/>
/// Default is 4 sec.<br/>
/// Setting this to <see cref="TimeSpan.MaxValue"/> will completely disable the auto hide feature.
/// </summary>
/// <remarks>This is effective only for managed scrollbars (WASM, macOS and Skia for now)</remarks>
public static TimeSpan? DefaultAutoHideDelay { get; set; }
#if __ANDROID__
/// <summary>
/// This value defines an optional delay to be set for native ScrollBar thumbs to disapear. The
/// platform default is 300ms, which can make the thumbs appear on screenshots, changing this value
/// to <see cref="TimeSpan.Zero"/> makes those disapear faster.
/// </summary>
public static TimeSpan? AndroidScrollbarFadeDelay { get; set; }
#endif
/// <summary>
/// Defines the delay of after which the ScrollViewer starts to move to snap points. The default value is 250ms.
/// </summary>
public static TimeSpan SnapDelay { get; set; } = TimeSpan.FromMilliseconds(250);
}
public static class ThemeAnimation
{
/// <summary>
/// Default duration for xxxThemeAnimation
/// </summary>
public static TimeSpan DefaultThemeAnimationDuration { get; set; } = TimeSpan.FromSeconds(0.75);
}
public static class ToolTip
{
public static bool UseToolTips { get; set; }
#if __WASM__ || __SKIA__
= true;
#endif
public static int ShowDelay { get; set; } = 1000;
public static int ShowDuration { get; set; } = 5000;
}
public static class NativeFramePresenter
{
#if __ANDROID__
/// <summary>
/// Determines if pages in the backstack are kept in the visual tree.
/// Defaults to false for performance considerations.
/// </summary>
public static bool AndroidUnloadInactivePages { get; set; }
#endif
}
public static class UIElement
{
/// <summary>
/// Call the .MeasureOverride only on element explicitly invalidating
/// their measure and when the available size is changing.
/// </summary>
public static bool UseInvalidateMeasurePath { get; set; } = true;
/// <summary>
/// Call the .ArrangeOverride only on elements explicitly invalidating
/// their arrange and when the final rect is changing.
/// </summary>
public static bool UseInvalidateArrangePath { get; set; } = true;
#if __ANDROID__
/// <summary>
/// On Android, rollback the clipping to the previous behavior, which was to apply the clipping
/// on the assigned children bounds instead of the parent bounds.
/// </summary>
public static bool UseLegacyClipping { get; set; }
#endif
/// <summary>
/// Enable the visualization of clipping bounds (intended for diagnostic purposes).
/// </summary>
/// <remarks>
/// This feature is only supported on iOS, for now.
/// </remarks>
public static bool ShowClippingBounds { get; set; }
/// <summary>
/// [WebAssembly Only] Enable the assignation of the "xamlname", "xuid" and "xamlautomationid" attributes on DOM elements created
/// from the XAML visual tree. This enables tools such as Puppeteer to select elements
/// in the DOM for automation purposes.
/// </summary>
public static bool AssignDOMXamlName { get; set; }
/// <summary>
/// [WebAssembly Only] Enable UIElement.ToString() to return the element's unique ID
/// </summary>
public static bool RenderToStringWithId { get; set; } = true;
/// <summary>
/// [WebAssembly Only] Enables the assignation of properties from the XAML visual tree as DOM attributes: Height -> "xamlheight",
/// HorizontalAlignment -> "xamlhorizontalalignment" etc.
/// </summary>
/// <remarks>
/// This should only be enabled for debug builds, but can greatly aid layout debugging.
///
/// Note: for release builds of Uno, if the flag is set, attributes will be set on loading and *not* updated if
/// the values change subsequently. This restriction doesn't apply to debug Uno builds.
/// </remarks>
public static bool AssignDOMXamlProperties { get; set; }
#if __ANDROID__
/// <summary>
/// When this is set, non-UIElements will always be clipped to their bounds (<see cref="Android.Views.ViewGroup.ClipChildren"/> will
/// always be set to true on their parent).
/// </summary>
/// <remarks>
/// This is true by default as most native views assume that they will be clipped, and can display incorrectly otherwise.
/// </remarks>
public static bool AlwaysClipNativeChildren { get; set; } = true;
#endif
/// <summary>
/// For non-holding pointer events, use CompleteGesture when bubbling gesture events.
/// This defaults to false, which prevents the specific event instead of calling CompleteGesture
/// </summary>
public static bool DisablePointersSpecificEventPrevention { get; set; }
/// <summary>
/// Enables failure when <see cref="Foundation.NSObjectExtensions.ValidateDispose"/> is invoked.
/// </summary>
public static bool FailOnNSObjectExtensionsValidateDispose { get; set; }
}
public static class VisualState
{
/// <summary>
/// When this is set, the <see cref="Microsoft.UI.Xaml.VisualState.Setters"/> will be applied synchronously when changing state,
/// unlike UWP which waits the for the end of the <see cref="VisualTransition.Storyboard"/> (if any) to apply them.
/// </summary>
/// <remarks>This flag is for backward compatibility with old versions of uno and should not be turned on.</remarks>
public static bool ApplySettersBeforeTransition { get; set; }
}
public static class WebView
{
#if __ANDROID__
/// <summary>
/// Prevent the WebView from using hardware rendering.
/// This was previously the default behavior in Uno to work around a keyboard-related visual glitch in Android 5.0 (http://stackoverflow.com/questions/27172217/android-systemui-glitches-in-lollipop), however it prevents video and 3d content from being rendered.
/// </summary>
/// <remarks>
/// See this for more info: https://github.com/unoplatform/uno/blob/26c5cc5992cae3c8c25adf51eb77ca4b0dd34e93/src/Uno.UI/UI/Xaml/Controls/WebView/WebView.Android.cs#L251_L255
/// </remarks>
public static bool ForceSoftwareRendering { get; set; }
#endif
}
public static class WebView2
{
#if __IOS__
/// <summary>
/// Sets whether the <see cref="WebView2"/> object is inspectable or not.
/// </summary>
/// <remarks>
/// On iOS and Catalyst this means that developers can use the Safari Web Developers tools to debug apps with <see cref="WebView2"/>
/// Important: It will only work when the app runs in Debug mode.
/// </remarks>
public static bool IsInspectable { get; set; }
#endif
}
public static class Xaml
{
/// <summary>
/// By default, XAML hot reload will be enabled when building in debug. Setting this flag to 'true' will force it to be disabled.
/// </summary>
public static bool ForceHotReloadDisabled { get; set; }
}
public static class DatePicker
{
#if __IOS__
/// <summary>
/// Gets or set whether the <see cref="Microsoft.UI.Xaml.Controls.DatePicker" /> rendered matches the Legacy Style or not.
/// </summary>
/// <remarks>
/// Important: This flag will only have an impact on iOS 14 devices
/// </remarks>
public static bool UseLegacyStyle { get; set; }
#endif
}
public static class TimePicker
{
#if __IOS__
/// <summary>
/// Gets or set whether the TimePicker rendered matches the Legacy Style or not.
/// </summary>
/// <remarks>
/// Important: This flag will only have an impact on iOS 14 devices
/// </remarks>
public static bool UseLegacyStyle { get; set; }
#endif
}
public static class TimePickerFlyout
{
#if __ANDROID__
/// <summary>
/// Gets or sets whether the <see cref="Microsoft.UI.Xaml.Controls.TimePickerFlyout"/> uses legacy time setting.
/// Legacy time setting is about preserving days, seconds, and milliseconds of
/// <see cref="Microsoft.UI.Xaml.Controls.TimePickerFlyout.Time"/>.
/// </summary>
/// <remarks>
/// This flag defaults to <see langword="false"/> to match UWP behavior, where a value set from UI is
/// only hours and minutes, and any previously set (programmatically) days, seconds, or milliseconds are cleared.
/// This flag is Android only.
/// </remarks>
public static bool UseLegacyTimeSetting { get; set; }
#endif
}
public static class CommandBar
{
#if __IOS__
/// <summary>
/// Gets or Set whether the AllowNativePresenterContent feature is on or off.
/// </summary>
/// <remarks>
/// This feature is used in the context of the sample application to test NavigationBars outside of a NativeFramePresenter for
/// UI Testing. In general cases, this should not happen as the bar may be moved back to to this presenter while
/// another page is already visible, making this bar overlay on top of another.
/// </remarks>
/// <returns>True if this feature is on, False otherwise</returns>
public static bool AllowNativePresenterContent { get; set; }
#endif
}
public static class AppBarButton
{
#if __ANDROID__
/// <summary>
/// Gets or set whether the EnableBitmapIconTint feature is on or off.
/// </summary>
/// <remarks>
/// This Feature will allow any <see cref="Microsoft.UI.Xaml.Controls.AppBarButton"/>
/// inside a <see cref="Microsoft.UI.Xaml.Controls.CommandBar"/> to use the Foreground <see cref="SolidColorBrush"/>
/// as their tint Color.
/// <para/>Default value is False.
/// </remarks>
/// <returns>True if this feature is on, False otherwise</returns>
public static bool EnableBitmapIconTint { get; set; }
#endif
}
public static class Cursors
{
#if UNO_REFERENCE_API
/// <summary>
/// Gets or sets a value indicating whether "interactive" controls like
/// Buttons and ToggleSwitches use the pointer cursor in WebAssembly
/// to emulate a "web-like" feel. Default is <see langword="true"/>.
/// </summary>
public static bool UseHandForInteraction { get; set; } = true;
#endif
}
public static class Timeline
{
/// <summary>
/// Determines if the default animation starting value
/// will be from the animated value or local value, when the From property is omitted.
/// </summary>
public static bool DefaultsStartingValueFromAnimatedValue { get; } = true;
}
public static class Rendering
{
/// <summary>
/// Determines if OpenGL rendering should be enabled on the X11 target. If null, defaults to
/// OpenGL if available. Otherwise, software rendering will be used.
/// </summary>
public static bool? UseOpenGLOnX11 { get; set; }
}
public static class DependencyProperty
{
/// <summary>
/// Accessing the dependency property system isn't thread safe and should only
/// happen on the UI thread.
/// By default, attempting to access it from non UI thread will throw an exception.
/// Setting this flag to true will prevent the exception from being thrown at the risk
/// of having an undefined behavior and/or race conditions.
/// </summary>
public static bool DisableThreadingCheck { get; set; }
}
}
}