|
@@ -0,0 +1,78 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Collections.ObjectModel;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using Newtonsoft.Json;
|
|
|
+using Xamarin.Forms;
|
|
|
+using Xamarin.Forms.Xaml;
|
|
|
+
|
|
|
+namespace InABox.Mobile
|
|
|
+{
|
|
|
+
|
|
|
+ public class MobileAccordionItem : BindableObject
|
|
|
+ {
|
|
|
+
|
|
|
+ private static readonly BindableProperty TextProperty =
|
|
|
+ BindableProperty.Create(nameof(Text), typeof(String), typeof(MobileAccordionItem), "");
|
|
|
+ public String Text
|
|
|
+ {
|
|
|
+ get => GetValue(TextProperty) as String;
|
|
|
+ set => SetValue(TextProperty, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static readonly BindableProperty ContentProperty =
|
|
|
+ BindableProperty.Create(nameof(Content), typeof(View), typeof(MobileAccordionItem));
|
|
|
+
|
|
|
+ public View Content
|
|
|
+ {
|
|
|
+ get => GetValue(ContentProperty) as View;
|
|
|
+ set => SetValue(ContentProperty, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static readonly BindableProperty VisibleProperty =
|
|
|
+ BindableProperty.Create(nameof(Visible), typeof(bool), typeof(MobileAccordionItem), true);
|
|
|
+
|
|
|
+ public bool Visible
|
|
|
+ {
|
|
|
+ get => (bool)GetValue(VisibleProperty);
|
|
|
+ set => SetValue(VisibleProperty, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static readonly BindableProperty ButtonVisibleProperty =
|
|
|
+ BindableProperty.Create(nameof(ButtonVisible), typeof(bool), typeof(MobileAccordionItem), true);
|
|
|
+
|
|
|
+ public bool ButtonVisible
|
|
|
+ {
|
|
|
+ get => (bool)GetValue(ButtonVisibleProperty);
|
|
|
+ set => SetValue(ButtonVisibleProperty, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ [XamlCompilation(XamlCompilationOptions.Compile)]
|
|
|
+ public partial class MobileAccordion
|
|
|
+ {
|
|
|
+
|
|
|
+ public IList<MobileAccordionItem> Items { get; private set; }
|
|
|
+
|
|
|
+ public MobileAccordion()
|
|
|
+ {
|
|
|
+ Items = new ObservableCollection<MobileAccordionItem>();
|
|
|
+ InitializeComponent();
|
|
|
+ BindableLayout.SetItemsSource(_stack, Items);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Header_Clicked(object sender, MobileButtonClickEventArgs args)
|
|
|
+ {
|
|
|
+ foreach (var item in Items)
|
|
|
+ item.Visible = (item == args.Tag);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void EmptyConverter_OnConverting(object sender, EmptyConverterConvertingEventArgs args)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|