diff --git a/Xamarin-Sidebar/Sidebar.cs b/Xamarin-Sidebar/Sidebar.cs index ef74dfb..04ff22b 100644 --- a/Xamarin-Sidebar/Sidebar.cs +++ b/Xamarin-Sidebar/Sidebar.cs @@ -107,6 +107,21 @@ public bool DisablePanGesture public float GestureActiveArea { get; set; } + public float ShadowOpacity { + get { return _sidebarContentArea.ShadowOpacity; } + set { _sidebarContentArea.ShadowOpacity = value; } + } + + public float ShadowRadius { + get { return _sidebarContentArea.ShadowRadius; } + set { _sidebarContentArea.ShadowRadius = value; } + } + + public UIColor ShadowColor { + get { return _sidebarContentArea.ShadowColor; } + set { _sidebarContentArea.ShadowColor = value; } + } + public bool HasShadowing { get; set; } public bool HasDarkOverlay { get; set; } diff --git a/Xamarin-Sidebar/SidebarContentArea.cs b/Xamarin-Sidebar/SidebarContentArea.cs index 1439195..1e7e33c 100644 --- a/Xamarin-Sidebar/SidebarContentArea.cs +++ b/Xamarin-Sidebar/SidebarContentArea.cs @@ -31,6 +31,13 @@ internal class SidebarContentArea public UIViewController ContentViewController { get; set; } + public float ShadowRadius { get; set; } = 4.0f; + + public float ShadowOpacity { get; set; } = 0.5f; + + public UIColor ShadowColor { get; set; } = UIColor.Black; + + public SidebarContentArea(UIViewController viewController) { ContentViewController = viewController; @@ -41,9 +48,9 @@ public SidebarContentArea(UIViewController viewController) { public void DisplayShadow(float position) { ContentViewController.View.Layer.ShadowOffset = new SizeF(position, 0); ContentViewController.View.Layer.ShadowPath = UIBezierPath.FromRect(ContentViewController.View.Bounds).CGPath; - ContentViewController.View.Layer.ShadowRadius = 4.0f; - ContentViewController.View.Layer.ShadowOpacity = 0.5f; - ContentViewController.View.Layer.ShadowColor = UIColor.Black.CGColor; + ContentViewController.View.Layer.ShadowRadius = ShadowRadius; + ContentViewController.View.Layer.ShadowOpacity = ShadowOpacity; + ContentViewController.View.Layer.ShadowColor = ShadowColor.CGColor; } public void HideShadow() { @@ -213,9 +220,9 @@ private void ShowShadowWhileDragging(bool hasShadowing, MenuLocations menuLocati var xOffset = (menuLocation == MenuLocations.Left) ? -5 : 5; ContentViewController.View.Layer.ShadowOffset = new SizeF(xOffset, 0); ContentViewController.View.Layer.ShadowPath = UIBezierPath.FromRect (ContentViewController.View.Bounds).CGPath; - ContentViewController.View.Layer.ShadowRadius = 4.0f; - ContentViewController.View.Layer.ShadowOpacity = 0.5f; - ContentViewController.View.Layer.ShadowColor = UIColor.Black.CGColor; + ContentViewController.View.Layer.ShadowRadius = ShadowRadius; + ContentViewController.View.Layer.ShadowOpacity = ShadowOpacity; + ContentViewController.View.Layer.ShadowColor = ShadowColor.CGColor; } } } diff --git a/Xamarin-Sidebar/SidebarController.cs b/Xamarin-Sidebar/SidebarController.cs index 1f68363..9617a11 100644 --- a/Xamarin-Sidebar/SidebarController.cs +++ b/Xamarin-Sidebar/SidebarController.cs @@ -83,7 +83,7 @@ public SidebarController( public UIViewController MenuAreaController { get { return _sidebar.MenuViewController; } } - /// + /// /// Determines the percent of width to complete slide action. /// public float FlingPercentage { @@ -91,7 +91,7 @@ public float FlingPercentage { set { _sidebar.FlingPercentage = value; } } - /// + /// /// Determines the minimum velocity considered a "fling" to complete slide action. /// public float FlingVelocity { @@ -115,6 +115,32 @@ public bool HasShadowing { set { _sidebar.HasShadowing = value; } } + /// + /// Gets or sets the shadow opacity. + /// + public float ShadowOpacity { + get { return _sidebar.ShadowOpacity; } + set { _sidebar.ShadowOpacity = value; } + } + + /// + /// Gets or sets the color of the shadow. + /// + public UIColor ShadowColor { + get { return _sidebar.ShadowColor; } + set { _sidebar.ShadowColor = value; } + } + + /// + /// Gets or sets the shadow radius. + /// + /// The shadow radius. + public float ShadowRadius + { + get { return _sidebar.ShadowRadius; } + set { _sidebar.ShadowRadius = value; } + } + /// /// Gets or sets a value indicating whether there should be a dark overlay effect on the content view. /// @@ -281,7 +307,7 @@ private void SetMenuViewPosition() { var menuFrame = MenuAreaController.View.Frame; menuFrame.X = MenuLocation == MenuLocations.Left ? 0 : View.Frame.Width - MenuWidth; menuFrame.Width = MenuWidth; - menuFrame.Height = View.Frame.Height; + menuFrame.Height = View.Frame.Height; MenuAreaController.View.Frame = menuFrame; }