123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Xamarin.Forms;
- using Xamarin.Forms.Xaml;
- using XF.Material.Forms.Resources.Typography;
- namespace InABox.Mobile
- {
- public class MobileSearchBarTextChangedArgs : EventArgs
- {
- public string Text { get; private set; }
- public MobileSearchBarTextChangedArgs(String text)
- {
- Text = text;
- }
- }
- public delegate void MobileSearchBatTextChanged(object sender, MobileSearchBarTextChangedArgs args);
-
- [XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class MobileSearchBar
- {
-
- private static readonly BindableProperty BorderColorProperty = BindableProperty.Create(
- nameof(BorderColor),
- typeof(Color),
- typeof(MobileSearchBar),
- Color.Gray);
- public Color BorderColor
- {
- get => (Color)GetValue(BorderColorProperty);
- set => SetValue(BorderColorProperty, value);
- }
-
- private static readonly BindableProperty TextBackgroundColorProperty = BindableProperty.Create(
- nameof(TextBackgroundColor),
- typeof(Color),
- typeof(MobileSearchBar),
- XF.Material.Forms.Material.Color.Surface);
- public Color TextBackgroundColor
- {
- get => (Color)GetValue(TextBackgroundColorProperty);
- set => SetValue(TextBackgroundColorProperty, value);
- }
-
- private static readonly BindableProperty TextColorProperty = BindableProperty.Create(
- nameof(TextColor),
- typeof(Color),
- typeof(MobileSearchBar),
- XF.Material.Forms.Material.Color.OnSurface);
- public Color TextColor
- {
- get => (Color)GetValue(TextColorProperty);
- set => SetValue(TextColorProperty, value);
- }
- private static readonly BindableProperty TextSizeProperty = BindableProperty.Create(
- nameof(TextSize),
- typeof(double),
- typeof(MobileSearchBar),
- 16D);
-
- public double TextSize
- {
- get => (double)GetValue(TextSizeProperty);
- set => SetValue(TextSizeProperty, value);
- }
- private static readonly BindableProperty PlaceHolderProperty = BindableProperty.Create(
- nameof(PlaceHolder),
- typeof(String),
- typeof(MobileSearchBar)
- );
-
- public String PlaceHolder
- {
- get => (String)GetValue(PlaceHolderProperty);
- set => SetValue(PlaceHolderProperty, value);
- }
-
- public event MobileSearchBatTextChanged TextChanged;
-
- public MobileSearchBar()
- {
- InitializeComponent();
- }
- private void _search_OnTextChanged(object sender, TextChangedEventArgs e)
- {
- TextChanged?.Invoke(this,new MobileSearchBarTextChangedArgs(e.NewTextValue));
- }
- }
- }
|