1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-03 00:53:27 +00:00

cell buttons

This commit is contained in:
Kyle Spearrin
2019-04-05 16:13:17 -04:00
parent 8c79c42b28
commit 3539d7389e
7 changed files with 445 additions and 223 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Windows.Input;
using Xamarin.Forms;
namespace Bit.App.Controls.BoxedView
@@ -15,6 +16,42 @@ namespace Bit.App.Controls.BoxedView
public static BindableProperty TitleFontSizeProperty = BindableProperty.Create(
nameof(TitleFontSize), typeof(double), typeof(BaseCell), -1.0, defaultBindingMode: BindingMode.OneWay);
public static BindableProperty Button1IconProperty = BindableProperty.Create(
nameof(Button1Icon), typeof(string), typeof(BaseCell), default(string),
defaultBindingMode: BindingMode.OneWay);
public static BindableProperty Button1CommandProperty = BindableProperty.Create(
nameof(Button1Command), typeof(ICommand), typeof(BaseCell), default(ICommand),
defaultBindingMode: BindingMode.OneWay);
public static BindableProperty Button1CommandParameterProperty = BindableProperty.Create(
nameof(Button1CommandParameter), typeof(object), typeof(BaseCell), default(object),
defaultBindingMode: BindingMode.OneWay);
public static BindableProperty Button2IconProperty = BindableProperty.Create(
nameof(Button2Icon), typeof(string), typeof(BaseCell), default(string),
defaultBindingMode: BindingMode.OneWay);
public static BindableProperty Button2CommandProperty = BindableProperty.Create(
nameof(Button2Command), typeof(ICommand), typeof(BaseCell), default(ICommand),
defaultBindingMode: BindingMode.OneWay);
public static BindableProperty Button2CommandParameterProperty = BindableProperty.Create(
nameof(Button2CommandParameter), typeof(object), typeof(BaseCell), default(object),
defaultBindingMode: BindingMode.OneWay);
public static BindableProperty Button3IconProperty = BindableProperty.Create(
nameof(Button3Icon), typeof(string), typeof(BaseCell), default(string),
defaultBindingMode: BindingMode.OneWay);
public static BindableProperty Button3CommandProperty = BindableProperty.Create(
nameof(Button3Command), typeof(ICommand), typeof(BaseCell), default(ICommand),
defaultBindingMode: BindingMode.OneWay);
public static BindableProperty Button3CommandParameterProperty = BindableProperty.Create(
nameof(Button3CommandParameter), typeof(object), typeof(BaseCell), default(object),
defaultBindingMode: BindingMode.OneWay);
public static BindableProperty BackgroundColorProperty = BindableProperty.Create(
nameof(BackgroundColor), typeof(Color), typeof(BaseCell), default(Color),
defaultBindingMode: BindingMode.OneWay);
@@ -38,6 +75,60 @@ namespace Bit.App.Controls.BoxedView
set => SetValue(TitleFontSizeProperty, value);
}
public string Button1Icon
{
get => (string)GetValue(Button1IconProperty);
set => SetValue(Button1IconProperty, value);
}
public ICommand Button1Command
{
get => (ICommand)GetValue(Button1CommandProperty);
set => SetValue(Button1CommandProperty, value);
}
public object Button1CommandParameter
{
get => GetValue(Button1CommandParameterProperty);
set => SetValue(Button1CommandParameterProperty, value);
}
public string Button2Icon
{
get => (string)GetValue(Button2IconProperty);
set => SetValue(Button2IconProperty, value);
}
public ICommand Button2Command
{
get => (ICommand)GetValue(Button2CommandProperty);
set => SetValue(Button2CommandProperty, value);
}
public object Button2CommandParameter
{
get => GetValue(Button2CommandParameterProperty);
set => SetValue(Button2CommandParameterProperty, value);
}
public string Button3Icon
{
get => (string)GetValue(Button3IconProperty);
set => SetValue(Button3IconProperty, value);
}
public ICommand Button3Command
{
get => (ICommand)GetValue(Button3CommandProperty);
set => SetValue(Button3CommandProperty, value);
}
public object Button3CommandParameter
{
get => GetValue(Button3CommandParameterProperty);
set => SetValue(Button3CommandParameterProperty, value);
}
public Color BackgroundColor
{
get => (Color)GetValue(BackgroundColorProperty);

View File

@@ -16,13 +16,22 @@
FooterText="The Footer"
UseDragSort="True">
<bv:EntryCell Title="The title"
ValueText="The value for entry" />
ValueText="The value for entry"
Button1Icon="cogs"
Button1Command="{Binding ButtonCommand}"
Button2Icon="cogs"
Button2Command="{Binding Button2Command}"
Button3Icon="cogs" />
<bv:LabelCell Title="The title"
ValueText="The value" />
<bv:LabelCell Title="The title 2"
Button1Icon="cogs"
Button1Command="{Binding ButtonCommand}"
Button3Icon="cogs"
ValueText="The value" />
<bv:LabelCell Title="The title 3"
ValueText="The value" />
ValueText="The value"
Button3Icon="cogs" />
<bv:LabelCell Title="The title 4"
ValueText="The value" />
<bv:LabelCell Title="The title 5"

View File

@@ -13,6 +13,8 @@ namespace Bit.App.Pages
public SettingsPage()
{
InitializeComponent();
var viewModel = BindingContext as SettingsPageViewModel;
viewModel.Page = this;
}
}
}

View File

@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Input;
using Xamarin.Forms;
namespace Bit.App.Pages
{
@@ -9,6 +11,12 @@ namespace Bit.App.Pages
public SettingsPageViewModel()
{
PageTitle = "Settings";
ButtonCommand = new Command(() => Page.DisplayAlert("Button 1 Command", "Button 1 message", "Cancel"));
Button2Command = new Command(() => Page.DisplayAlert("Button 2 Command", "Button 2 message", "Cancel"));
}
public ICommand ButtonCommand { get; }
public ICommand Button2Command { get; }
}
}