@@ -348,7 +348,7 @@ internal static DataTemplate CreateDefaultFlyoutItemCell(string textBinding, str
348
348
IgnoreSafeArea = true
349
349
} ;
350
350
351
- if ( DeviceInfo . Platform == DevicePlatform . WinUI )
351
+ if ( OperatingSystem . IsWindows ( ) )
352
352
grid . ColumnSpacing = grid . RowSpacing = 0 ;
353
353
354
354
grid . Resources = new ResourceDictionary ( ) ;
@@ -387,7 +387,7 @@ internal static DataTemplate CreateDefaultFlyoutItemCell(string textBinding, str
387
387
var selectedState = new VisualState ( ) ;
388
388
selectedState . Name = "Selected" ;
389
389
390
- if ( DeviceInfo . Platform != DevicePlatform . WinUI )
390
+ if ( ! OperatingSystem . IsWindows ( ) )
391
391
{
392
392
selectedState . Setters . Add ( new Setter
393
393
{
@@ -406,19 +406,19 @@ internal static DataTemplate CreateDefaultFlyoutItemCell(string textBinding, str
406
406
407
407
defaultGridClass . Setters . Add ( new Setter { Property = VisualStateManager . VisualStateGroupsProperty , Value = groups } ) ;
408
408
409
- if ( DeviceInfo . Platform == DevicePlatform . Android )
409
+ if ( OperatingSystem . IsAndroid ( ) )
410
410
defaultGridClass . Setters . Add ( new Setter { Property = Grid . HeightRequestProperty , Value = 50 } ) ;
411
411
else
412
412
defaultGridClass . Setters . Add ( new Setter { Property = Grid . HeightRequestProperty , Value = 44 } ) ;
413
413
414
414
415
415
ColumnDefinitionCollection columnDefinitions = new ColumnDefinitionCollection ( ) ;
416
416
417
- if ( DeviceInfo . Platform == DevicePlatform . Android )
417
+ if ( OperatingSystem . IsAndroid ( ) )
418
418
columnDefinitions . Add ( new ColumnDefinition { Width = 54 } ) ;
419
- else if ( DeviceInfo . Platform == DevicePlatform . iOS )
419
+ else if ( OperatingSystem . IsIOS ( ) || OperatingSystem . IsMacCatalyst ( ) )
420
420
columnDefinitions . Add ( new ColumnDefinition { Width = 50 } ) ;
421
- else if ( DeviceInfo . Platform == DevicePlatform . WinUI )
421
+ else if ( OperatingSystem . IsWindows ( ) )
422
422
columnDefinitions . Add ( new ColumnDefinition { Width = GridLength . Auto } ) ;
423
423
else if ( DeviceInfo . Platform == DevicePlatform . Tizen )
424
424
columnDefinitions . Add ( new ColumnDefinition { Width = GridLength . Auto } ) ;
@@ -432,11 +432,11 @@ internal static DataTemplate CreateDefaultFlyoutItemCell(string textBinding, str
432
432
var image = new Image ( ) ;
433
433
434
434
double sizeRequest = - 1 ;
435
- if ( DeviceInfo . Platform == DevicePlatform . Android )
435
+ if ( OperatingSystem . IsAndroid ( ) )
436
436
sizeRequest = 24 ;
437
- else if ( DeviceInfo . Platform == DevicePlatform . iOS )
437
+ else if ( OperatingSystem . IsIOS ( ) || OperatingSystem . IsMacCatalyst ( ) )
438
438
sizeRequest = 22 ;
439
- else if ( DeviceInfo . Platform == DevicePlatform . WinUI )
439
+ else if ( OperatingSystem . IsWindows ( ) )
440
440
sizeRequest = 16 ;
441
441
else if ( DeviceInfo . Platform == DevicePlatform . Tizen )
442
442
sizeRequest = 25 ;
@@ -447,7 +447,7 @@ internal static DataTemplate CreateDefaultFlyoutItemCell(string textBinding, str
447
447
defaultImageClass . Setters . Add ( new Setter ( ) { Property = Image . WidthRequestProperty , Value = sizeRequest } ) ;
448
448
}
449
449
450
- if ( DeviceInfo . Platform == DevicePlatform . WinUI )
450
+ if ( OperatingSystem . IsWindows ( ) )
451
451
{
452
452
defaultImageClass . Setters . Add ( new Setter { Property = Image . HorizontalOptionsProperty , Value = LayoutOptions . Start } ) ;
453
453
defaultImageClass . Setters . Add ( new Setter { Property = Image . MarginProperty , Value = new Thickness ( 12 , 0 , 12 , 0 ) } ) ;
@@ -464,7 +464,7 @@ internal static DataTemplate CreateDefaultFlyoutItemCell(string textBinding, str
464
464
465
465
grid . Add ( label , 1 , 0 ) ;
466
466
467
- if ( DeviceInfo . Platform == DevicePlatform . Android )
467
+ if ( OperatingSystem . IsAndroid ( ) )
468
468
{
469
469
object textColor ;
470
470
@@ -482,12 +482,12 @@ internal static DataTemplate CreateDefaultFlyoutItemCell(string textBinding, str
482
482
defaultLabelClass . Setters . Add ( new Setter { Property = Label . FontFamilyProperty , Value = "sans-serif-medium" } ) ;
483
483
defaultLabelClass . Setters . Add ( new Setter { Property = Label . MarginProperty , Value = new Thickness ( 20 , 0 , 0 , 0 ) } ) ;
484
484
}
485
- else if ( DeviceInfo . Platform == DevicePlatform . iOS )
485
+ else if ( OperatingSystem . IsIOS ( ) || OperatingSystem . IsMacCatalyst ( ) )
486
486
{
487
487
defaultLabelClass . Setters . Add ( new Setter { Property = Label . FontSizeProperty , Value = 14 } ) ;
488
488
defaultLabelClass . Setters . Add ( new Setter { Property = Label . FontAttributesProperty , Value = FontAttributes . Bold } ) ;
489
489
}
490
- else if ( DeviceInfo . Platform == DevicePlatform . WinUI )
490
+ else if ( OperatingSystem . IsWindows ( ) )
491
491
{
492
492
defaultLabelClass . Setters . Add ( new Setter { Property = Label . HorizontalOptionsProperty , Value = LayoutOptions . Start } ) ;
493
493
defaultLabelClass . Setters . Add ( new Setter { Property = Label . HorizontalTextAlignmentProperty , Value = TextAlignment . Start } ) ;
@@ -537,6 +537,16 @@ internal static DataTemplate CreateDefaultFlyoutItemCell(string textBinding, str
537
537
return grid ;
538
538
} ) ;
539
539
}
540
+
541
+ #if NETSTANDARD
542
+ sealed class OperatingSystem
543
+ {
544
+ public static bool IsAndroid ( ) => false ;
545
+ public static bool IsIOS ( ) => false ;
546
+ public static bool IsMacCatalyst ( ) => false ;
547
+ public static bool IsWindows ( ) => false ;
548
+ }
549
+ #endif
540
550
}
541
551
542
552
public interface IQueryAttributable
0 commit comments