Skip to content

Commit

Permalink
style: format code with dotnet-format
Browse files Browse the repository at this point in the history
Format code with dotnet-format

This commit fixes the style issues introduced in 2625757 according to the output
from dotnet-format.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored Aug 20, 2023
1 parent 2625757 commit fd28243
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 41 deletions.
2 changes: 1 addition & 1 deletion MauiPaint/Platforms/Windows/DragDropHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static void UnRegisterDrop(UIElement element)
element.Drop -= dragEventHandler;
DragEventHandlers.Remove(element);
}

element.DragOver -= OnDragOver;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public CustomShellItemRenderer(IShellContext context) : base(context)
public override View? OnCreateView(LayoutInflater inflater, ViewGroup? container, Bundle? savedInstanceState)
{
var view = base.OnCreateView(inflater, container, savedInstanceState);
if (Context is not null && ShellItem is CustomTabBar {CenterViewVisible: true} tabBar)
if (Context is not null && ShellItem is CustomTabBar { CenterViewVisible: true } tabBar)
{
var rootLayout = new FrameLayout(Context)
{
Expand All @@ -28,9 +28,9 @@ public CustomShellItemRenderer(IShellContext context) : base(context)
rootLayout.AddView(view);
const int middleViewSize = 150;
var middleViewLayoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
ViewGroup.LayoutParams.WrapContent,
GravityFlags.CenterHorizontal |
GravityFlags.Bottom)
ViewGroup.LayoutParams.WrapContent,
GravityFlags.CenterHorizontal |
GravityFlags.Bottom)
{
BottomMargin = 100,
Width = middleViewSize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public CustomShellSectionRenderer(IShellContext shellContext) : base(shellContex
{
var relativeLayout = new RelativeLayout(Context);
relativeLayout.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent,
ViewGroup.LayoutParams.MatchParent);
ViewGroup.LayoutParams.MatchParent);

var view = base.OnCreateView(inflater, container, savedInstanceState);
if (view is not CoordinatorLayout coordinatorLayout)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public CustomShellItemRenderer(IShellContext context) : base(context)
public override async void ViewWillLayoutSubviews()
{
base.ViewWillLayoutSubviews();
if (View is not null && ShellItem is CustomTabBar {CenterViewVisible: true} tabbar)
if (View is not null && ShellItem is CustomTabBar { CenterViewVisible: true } tabbar)
{
if (middleView is not null)
{
Expand All @@ -39,8 +39,8 @@ public override async void ViewWillLayoutSubviews()
}

middleView.AutoresizingMask = UIViewAutoresizing.FlexibleRightMargin |
UIViewAutoresizing.FlexibleLeftMargin |
UIViewAutoresizing.FlexibleBottomMargin;
UIViewAutoresizing.FlexibleLeftMargin |
UIViewAutoresizing.FlexibleBottomMargin;
middleView.Layer.CornerRadius = middleView.Frame.Width / 2;
middleView.Layer.MasksToBounds = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public override void UpdateLayout(UITabBarController controller)
const int bottomSpace = 50;
const int margin = 30;
controller.TabBar.Frame = new CoreGraphics.CGRect(controller.TabBar.Frame.X + margin,
controller.TabBar.Frame.Y - bottomSpace,
controller.TabBar.Frame.Width - 2 * margin,
controller.TabBar.Frame.Height);
controller.TabBar.Frame.Y - bottomSpace,
controller.TabBar.Frame.Width - 2 * margin,
controller.TabBar.Frame.Height);

const int cornerRadius = 30;
var uIBezierPath = UIBezierPath.FromRoundedRect(controller.TabBar.Bounds, UIRectCorner.AllCorners,
new CoreGraphics.CGSize(cornerRadius, cornerRadius));
new CoreGraphics.CGSize(cornerRadius, cornerRadius));

var cAShapeLayer = new CAShapeLayer
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ public void UpdateLayout(UINavigationController controller)
baseTracker.UpdateLayout(controller);
var topSpace = controller.NavigationBar.Bounds.Height / 2;
controller.NavigationBar.Frame = new CoreGraphics.CGRect(controller.NavigationBar.Frame.X + topSpace,
controller.NavigationBar.Frame.Y + topSpace,
controller.NavigationBar.Frame.Width - 2 * topSpace,
controller.NavigationBar.Frame.Height);
controller.NavigationBar.Frame.Y + topSpace,
controller.NavigationBar.Frame.Width - 2 * topSpace,
controller.NavigationBar.Frame.Height);

const int cornerRadius = 30;
var uIBezierPath = UIBezierPath.FromRoundedRect(controller.NavigationBar.Bounds, UIRectCorner.AllCorners,
new CoreGraphics.CGSize(cornerRadius, cornerRadius));
new CoreGraphics.CGSize(cornerRadius, cornerRadius));

var cAShapeLayer = new CAShapeLayer
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


namespace MauiShellCustomization;
using Microsoft.Maui.Controls.Handlers;
using Microsoft.Maui.Controls.Platform;
Expand Down
33 changes: 21 additions & 12 deletions MauiShellCustomization/Platforms/Windows/CustomShellHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,25 @@ private void ShellViewOnLoaded(object sender, RoutedEventArgs e)
private static DataTemplate CreateNavigationViewItemDataTemplate()
{
var xaml = """
<DataTemplate xmlns = 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
<NavigationViewItem BackgroundSizing = "OuterBorderEdge"
Content = "{Binding Content}"
Foreground = "{Binding Foreground}"
Background = "{Binding Background}"
IsSelected = "{Binding IsSelected, Mode=TwoWay}"
MenuItemsSource = "{Binding MenuItemsSource}"
Icon = "{Binding Icon}" />
</DataTemplate>
""";
< DataTemplate xmlns = 'http://schemas.microsoft.com/winfx/2006/xaml/presentation' >


< NavigationViewItem BackgroundSizing = "OuterBorderEdge"

Content = "{Binding Content}"

Foreground = "{Binding Foreground}"

Background = "{Binding Background}"

IsSelected = "{Binding IsSelected, Mode=TwoWay}"

MenuItemsSource = "{Binding MenuItemsSource}"

Icon = "{Binding Icon}" />

</ DataTemplate >
""";

var dataTemplate = (DataTemplate)XamlReader.Load(xaml);
return dataTemplate;
Expand All @@ -101,8 +110,8 @@ private static Style CreateNavItemViewContainerStyle()
private static Grid? TopNavGrid(MauiNavigationView content)
{
var topNavAreaProperty = content.GetType()
.GetProperty("TopNavMenuItemsHost",
BindingFlags.NonPublic | BindingFlags.Instance);
.GetProperty("TopNavMenuItemsHost",
BindingFlags.NonPublic | BindingFlags.Instance);
return (((topNavAreaProperty?.GetValue(content) as ItemsRepeater)?.Parent as ScrollViewer)?.Parent as
ItemsRepeaterScrollHost)?.Parent as Grid;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public CustomShellItemRenderer(IShellContext context) : base(context)
public override async void ViewWillLayoutSubviews()
{
base.ViewWillLayoutSubviews();
if (View is not null && ShellItem is CustomTabBar {CenterViewVisible: true} tabbar)
if (View is not null && ShellItem is CustomTabBar { CenterViewVisible: true } tabbar)
{
if (middleView is not null)
{
Expand All @@ -39,8 +39,8 @@ public override async void ViewWillLayoutSubviews()
}

middleView.AutoresizingMask = UIViewAutoresizing.FlexibleRightMargin |
UIViewAutoresizing.FlexibleLeftMargin |
UIViewAutoresizing.FlexibleBottomMargin;
UIViewAutoresizing.FlexibleLeftMargin |
UIViewAutoresizing.FlexibleBottomMargin;
middleView.Layer.CornerRadius = middleView.Frame.Width / 2;
middleView.Layer.MasksToBounds = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ public void UpdateLayout(UINavigationController controller)
baseTracker.UpdateLayout(controller);
var topSpace = controller.NavigationBar.Bounds.Height / 2;
controller.NavigationBar.Frame = new CGRect(controller.NavigationBar.Frame.X + topSpace,
controller.NavigationBar.Frame.Y + topSpace,
controller.NavigationBar.Frame.Width - (2 * topSpace),
controller.NavigationBar.Frame.Height);
controller.NavigationBar.Frame.Y + topSpace,
controller.NavigationBar.Frame.Width - (2 * topSpace),
controller.NavigationBar.Frame.Height);

const int cornerRadius = 30;
var uIBezierPath = UIBezierPath.FromRoundedRect(controller.NavigationBar.Bounds, UIRectCorner.AllCorners,
new CGSize(cornerRadius, cornerRadius));
new CGSize(cornerRadius, cornerRadius));

var cAShapeLayer = new CAShapeLayer
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public override void UpdateLayout(UITabBarController controller)
const int bottomSpace = 50;
const int margin = 30;
controller.TabBar.Frame = new CGRect(controller.TabBar.Frame.X + margin,
controller.TabBar.Frame.Y - bottomSpace,
controller.TabBar.Frame.Width - (2 * margin),
controller.TabBar.Frame.Height);
controller.TabBar.Frame.Y - bottomSpace,
controller.TabBar.Frame.Width - (2 * margin),
controller.TabBar.Frame.Height);

const int cornerRadius = 30;
var uIBezierPath = UIBezierPath.FromRoundedRect(controller.TabBar.Bounds, UIRectCorner.AllCorners,
new CGSize(cornerRadius, cornerRadius));
new CGSize(cornerRadius, cornerRadius));

var cAShapeLayer = new CAShapeLayer
{
Expand Down

0 comments on commit fd28243

Please sign in to comment.