-
Notifications
You must be signed in to change notification settings - Fork 201
/
Copy pathMultiSelect.xaml.cs
92 lines (83 loc) · 2.63 KB
/
MultiSelect.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#region Copyright Syncfusion® Inc. 2001-2025.
// Copyright Syncfusion® Inc. 2001-2025. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// [email protected]. Any infringement will be prosecuted under
// applicable laws.
#endregion
using System;
using System.Collections.Generic;
using Xamarin.Forms;
using SampleBrowser.Core;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Globalization;
namespace SampleBrowser.SfAutoComplete
{
public partial class MultiSelect : SampleView
{
bool closeDropdownOnSelection;
public MultiSelect()
{
InitializeComponent();
this.BindingContext = new MultiSelectViewModel();
}
private void autocomplete_DropDownClosing(object sender, Syncfusion.SfAutoComplete.XForms.DropDownCancelEventArgs e)
{
if (!closeDropdownOnSelection)
{
if (e.IsItemSelected)
{
e.Cancel = true;
}
else
{
e.Cancel = false;
}
}
else
{
e.Cancel = false;
}
}
private void closeDropdownOnSelection_Toggled(object sender, ToggledEventArgs e)
{
if (e.Value)
{
closeDropdownOnSelection = true;
}
else
{
closeDropdownOnSelection = false;
}
}
void ScrollView_Scrolled(System.Object sender, Xamarin.Forms.ScrolledEventArgs e)
{
if (Device.RuntimePlatform == Device.iOS)
{
scrollView.ScrollToAsync(0, 0, false);
}
}
}
public class StringToColorConverter : IValueConverter
{
object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
if (value.ToString() == "Blue")
return Color.Blue;
else if (value.ToString() == "Red")
return Color.Red;
else if (value.ToString() == "Green")
return Color.Green;
}
return Color.Blue;
}
object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}