-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathLookupPage.xaml.cs
61 lines (55 loc) · 1.98 KB
/
LookupPage.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using PCCE.Model;
using PCCE.ViewModel;
namespace PCCE;
public partial class LookupPage : ContentPage
{
readonly LookupViewModel viewModel;
//int incomingIndex = 0;
public LookupPage(LookupViewModel vm)
{
InitializeComponent();
BindingContext = vm;
viewModel = vm;
}
private void SearchEntry_TextChanged(object sender, TextChangedEventArgs e)
{
if (string.IsNullOrEmpty(e.NewTextValue))
{
LookupCollectionView.ItemsSource = viewModel.ListedItems;
}
else
{
LookupCollectionView.ItemsSource = viewModel.ListedItems.Where(i => i.ItemID.ToString().Contains(e.NewTextValue, StringComparison.CurrentCultureIgnoreCase) ||
i.ItemIName.Contains(e.NewTextValue, StringComparison.CurrentCultureIgnoreCase) ||
i.ItemDisplayName.Contains(e.NewTextValue, StringComparison.CurrentCultureIgnoreCase));
}
}
private void LookupCollectionView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
private void Incoming_TextChanged(object sender, TextChangedEventArgs e)
{
/*
if (!string.IsNullOrEmpty(e.NewTextValue))
{
for (int i = 0; i < viewModel.ListedItems.Count; i++)
{
if (e.NewTextValue == viewModel.ListedItems[i].ItemID.ToString())
{
incomingIndex = i;
break;
}
}
}
*/
}
private void ContentPage_Loaded(object sender, EventArgs e)
{
LookupCollectionView.ScrollTo(viewModel.ItemSelected, null, ScrollToPosition.Center, false);
/*
LookupCollectionView.ScrollTo(incomingIndex, -1, ScrollToPosition.Center, false);
LookupCollectionView.SelectedItem = 0;
viewModel.ItemSelected = null;
*/
}
}