/// <summary>
        /// Event Handler when a user types something in a text box
        /// </summary>
        private async void nameField_KeyDown(object sender, KeyRoutedEventArgs e)
        {
            TextBox t    = (TextBox)sender;
            Friend  item = t.DataContext as Friend;

            // if ESC is pressed, restore the old value
            if (e.Key == Windows.System.VirtualKey.Escape)
            {
                t.Text = item.Viewer;
                t.Focus(FocusState.Unfocused);
                return;
            }

            // if Enter is pressed, store the new value
            if (e.Key == Windows.System.VirtualKey.Enter)
            {
                item.Viewer = t.Text;
                StartNetworkActivity();
                try
                {
                    await dataTable.UpdateAsync(item);

                    PeopleListView.Focus(FocusState.Unfocused);
                }
                catch (MobileServiceInvalidOperationException exception)
                {
                    var dialog = new MessageDialog(exception.Message);
                    await dialog.ShowAsync();
                }
                StopNetworkActivity();
                return;
            }
        }
Esempio n. 2
0
        private void ShowPeopleListView()
        {
            if (_peopleListView == null)
            {
                _peopleListView = new PeopleListView(ShowAddPersonView, ShowFilterWindow);
            }

            ShowView(_peopleListView);
        }
Esempio n. 3
0
        private void SetUpRecycleView()
        {
            var adapter = new CardRecyclerAdapter(this, Vm.People);

            PeopleListView.SetAdapter(adapter);

            var linearLayoutVerticalManager = new LinearLayoutManager(this);

            linearLayoutVerticalManager.Orientation = LinearLayoutManager.Vertical;
            PeopleListView.SetLayoutManager(linearLayoutVerticalManager);

            PeopleListView.SetItemAnimator(new DefaultItemAnimator());
        }
Esempio n. 4
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            if (mv.IsBusy == false)
            {
                PeopleListView.BeginRefresh();
                await mv.PopulatePeople();

                PeopleListView.ItemsSource = mv.GroupedPeople;
                PeopleListView.EndRefresh();
            }
        }
Esempio n. 5
0
        private void ListViewExample_Load(object sender, EventArgs e)
        {
            PeopleListView.View = View.Details;
            PeopleListView.Columns.Add("Name", "Name");
            PeopleListView.Columns.Add("Gender", "Gender");
            PeopleListView.Columns.Add("Age", "Age");
            PeopleListView.Columns.Add("Last", "Last");

            PeopleListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            PeopleListView.Columns.RemoveByKey("Last");

            //Align
            PeopleListView.Columns[0].TextAlign     = HorizontalAlignment.Left;
            PeopleListView.Columns["Age"].TextAlign = HorizontalAlignment.Center;
            PeopleListView.Columns[2].TextAlign     = HorizontalAlignment.Left;
        }
Esempio n. 6
0
        private void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
        {
            PeopleListView.BeginRefresh();

            if (string.IsNullOrWhiteSpace(e.NewTextValue))
            {
                mv.createGrouping(false);
                PeopleListView.ItemsSource = mv.GroupedPeople;
            }
            else
            {
                mv.createGrouping(true, e.NewTextValue);
                PeopleListView.ItemsSource = mv.GroupedPeople;
            }

            PeopleListView.EndRefresh();
        }