private void SelectFirstOccurrence() { currentResult = 0; var token = SearchToken; if (!string.IsNullOrEmpty(token)) { var message = LogMessages.FirstOrDefault(Match); logGridView.SelectedItem = message; if (message != null) { logGridView.BringItemIntoView(message); } } }
/// <summary> /// Select candidate. /// </summary> /// <param name="item">Candidate.</param> public void SelectCandidate(AddressCandidate item) { if (item == null) { if (DataGridControl.SelectedItems.Count > 0) { DataGridControl.SelectedItems.Clear(); } Debug.Assert(DataGridControl.SelectedItems.Count == 0); } else { if (DataGridControl.SelectedItems.Count == 0) { DataGridControl.SelectedItems.Add(item); } else { Debug.Assert(DataGridControl.SelectedItems.Count == 1); DataGridControl.SelectedItems.Clear(); DataGridControl.SelectedItems.Add(item); } DataGridControl.BringItemIntoView(item); } _SetButtonApplyIsEnabled(); }
/// <summary> /// React on edit committed. /// </summary> /// <param name="sender">Ignored.</param> /// <param name="e">Event args.</param> private void _EditCommitted(object sender, DataGridItemEventArgs e) { // If last item was edited - add new item. if (_locations.IndexOf((Location)e.Item) == _locations.Count - 1) { Location location = _CreateLocationWithFakeNameAndWithoutValidation(); _locations.Add(location); // Make postponed bring item into view. Dispatcher.BeginInvoke( new Action(delegate() { DataGridControl.BringItemIntoView(_locations[_locations.Count - 1]); _ProcessLocateState(); } ), DispatcherPriority.Background); } }