Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 42 additions & 5 deletions SlideOverKit/SlideMenuView.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

using Xamarin.Forms;

Expand All @@ -13,15 +13,27 @@ public enum MenuOrientation
RightToLeft,
}

public class SlideMenuView : ContentView
public class MenuShowEventArgs : EventArgs
{
public bool IsShown { get; private set; }
public MenuShowEventArgs(bool isShown)
{
IsShown = isShown;
}
}
public delegate void MenuShowEventHandler(object source, MenuShowEventArgs e);


public class SlideMenuView : ContentView
{
public SlideMenuView ()
{
// It must set background color, otherwise it will cannot be dragged in Android
this.BackgroundColor = Color.White;
}

public static readonly BindableProperty MenuOrientationsProperty = BindableProperty.Create (

public static readonly BindableProperty MenuOrientationsProperty = BindableProperty.Create (
"MenuOrientations",
typeof(MenuOrientation),
typeof(SlideMenuView),
Expand Down Expand Up @@ -141,9 +153,34 @@ public Color BackgroundViewColor {
}
}

internal Action HideEvent { get; set; }
public static readonly BindableProperty IsMenuShownProperty = BindableProperty.Create(
"IsMenuShownProperty",
typeof(bool),
typeof(SlideMenuView),
false);

public bool IsMenuShown
{
get
{
return (bool)GetValue(IsMenuShownProperty);
}
set
{
if (IsMenuShown != value)
{
SetValue(IsMenuShownProperty, value);
if (OnMenuToggle != null)
{
OnMenuToggle(this, new MenuShowEventArgs(IsMenuShown));
}
}
}
}
public event MenuShowEventHandler OnMenuToggle;
internal Action HideEvent { get; set; }

public void HideWithoutAnimations ()
public void HideWithoutAnimations ()
{
if (HideEvent != null)
HideEvent ();
Expand Down