mirror of
https://github.com/bitwarden/mobile
synced 2025-12-27 05:33:23 +00:00
47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using System.Windows.Input;
|
|
using Microsoft.Maui.Controls;
|
|
using Microsoft.Maui;
|
|
|
|
namespace Bit.App.Controls
|
|
{
|
|
public partial class SwitchItemView : BaseSettingItemView
|
|
{
|
|
public static readonly BindableProperty IsToggledProperty = BindableProperty.Create(
|
|
nameof(IsToggled), typeof(bool), typeof(SwitchItemView), null, BindingMode.TwoWay);
|
|
|
|
public static readonly BindableProperty SwitchAutomationIdProperty = BindableProperty.Create(
|
|
nameof(SwitchAutomationId), typeof(string), typeof(SwitchItemView), null, BindingMode.OneWay);
|
|
|
|
public static readonly BindableProperty ToggleSwitchCommandProperty = BindableProperty.Create(
|
|
nameof(ToggleSwitchCommand), typeof(ICommand), typeof(ExternalLinkItemView));
|
|
|
|
public SwitchItemView()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public bool IsToggled
|
|
{
|
|
get { return (bool)GetValue(IsToggledProperty); }
|
|
set { SetValue(IsToggledProperty, value); }
|
|
}
|
|
|
|
public string SwitchAutomationId
|
|
{
|
|
get { return (string)GetValue(SwitchAutomationIdProperty); }
|
|
set { SetValue(SwitchAutomationIdProperty, value); }
|
|
}
|
|
|
|
public ICommand ToggleSwitchCommand
|
|
{
|
|
get => GetValue(ToggleSwitchCommandProperty) as ICommand;
|
|
set => SetValue(ToggleSwitchCommandProperty, value);
|
|
}
|
|
|
|
void ContentView_Tapped(System.Object sender, System.EventArgs e)
|
|
{
|
|
_switch.IsToggled = !_switch.IsToggled;
|
|
}
|
|
}
|
|
}
|