Example #1
0
        /// <summary>
        /// On the attached property.
        /// </summary>
        /// <param name="bindable">Bindable.</param>
        protected override void OnAttachedTo(Entry entry)
        {
            base.OnAttachedTo(entry);

            entry.Completed += (object sender, EventArgs e) =>
            {
                if (inputChipGroup != null && !string.IsNullOrEmpty(entry.Text))
                {
                    ChipViewModel viewModel = entry.BindingContext as ChipViewModel;
                    if (viewModel != null)
                    {
                        if (viewModel.SelectedItem.ToString() == "Television")
                        {
                            viewModel.televisionItems.Add(entry.Text);
                        }
                        else if (viewModel.SelectedItem.ToString() == "Washer")
                        {
                            viewModel.washserItems.Add(entry.Text);
                        }
                        else if (viewModel.SelectedItem.ToString() == "Air Conditioner")
                        {
                            viewModel.airConditionerItems.Add(entry.Text);
                        }
                    }
                    entry.Text        = string.Empty;
                    entry.Placeholder = "Type a brand";
                }
                if (string.IsNullOrEmpty(entry.Text))
                {
                    entry.Unfocus();
                }
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:SampleBrowser.Chips.GettingStarted"/> class.
        /// </summary>
        public GettingStarted()
        {
            InitializeComponent();

            viewModel           = new ChipViewModel();
            this.BindingContext = viewModel;
        }