Support new features of Tizen.CircularUI (#188)
[platform/core/csapi/xsf.git] / src / XSF / Tizen.Wearable.CircularUI.Forms / CircularShell.cs
1 using Xamarin.Forms;
2
3 namespace Tizen.Wearable.CircularUI.Forms
4 {
5     public class CircularShell : Shell
6     {
7         public static readonly BindableProperty FlyoutIconBackgroundColorProperty = BindableProperty.CreateAttached("FlyoutIconBackgroundColor", typeof(Color), typeof(Shell), Color.Default);
8         public static readonly BindableProperty FlyoutForegroundColorProperty = BindableProperty.CreateAttached("FlyoutForegroundColor", typeof(Color), typeof(Shell), Color.Default);
9
10         public static Color GetFlyoutIconBackgroundColor(BindableObject element)
11         {
12             return (Color)element.GetValue(FlyoutIconBackgroundColorProperty);
13         }
14
15         public static void SetFlyoutIconBackgroundColor(BindableObject element, Color color)
16         {
17             element.SetValue(FlyoutIconBackgroundColorProperty, color);
18         }
19
20         public static Color GetFlyoutForegroundColor(BindableObject element)
21         {
22             return (Color)element.GetValue(FlyoutForegroundColorProperty);
23         }
24
25         public static void SetFlyoutForegroundColor(BindableObject element, Color color)
26         {
27             element.SetValue(FlyoutForegroundColorProperty, color);
28         }
29
30         public Color FlyoutIconBackgroundColor
31         {
32             get => (Color)GetValue(FlyoutIconBackgroundColorProperty);
33             set => SetValue(FlyoutIconBackgroundColorProperty, value);
34         }
35
36         public Color FlyoutForegroundColor
37         {
38             get => (Color)GetValue(FlyoutForegroundColorProperty);
39             set => SetValue(FlyoutForegroundColorProperty, value);
40         }
41
42         protected override bool OnBackButtonPressed()
43         {
44             if (FlyoutIsPresented)
45             {
46                 FlyoutIsPresented = false;
47                 return true;
48             }
49             return base.OnBackButtonPressed();
50         }
51     }
52 }