1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- 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 comal.timesheets
- {
- 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 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),
- 14D);
-
- 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));
- }
- }
- }
|