forked from syncfusion/xamarin-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DiacriticSamplePage.cs
69 lines (61 loc) · 2.33 KB
/
DiacriticSamplePage.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
#region Copyright Syncfusion Inc. 2001-2022.
// Copyright Syncfusion Inc. 2001-2022. 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 Android.Util;
using System;
using Android.Views;
using SampleBrowser;
using Android.Widget;
using Com.Syncfusion.Autocomplete;
namespace SampleBrowser
{
public class DiacriticSamplePage : SamplePage
{
LinearLayout mainLayout;
int width;
double density;
public override View GetPropertyWindowLayout(Android.Content.Context context)
{
return null;
}
public override View GetSampleContent(Android.Content.Context con)
{
width = con.Resources.DisplayMetrics.WidthPixels;
density = con.Resources.DisplayMetrics.Density;
mainLayout = new LinearLayout(con);
mainLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
mainLayout.Orientation = Orientation.Vertical;
mainLayout.SetPadding(20, 20, 20, 20);
LabelMethod(con);
AutoCompleteMethod(con);
return mainLayout;
}
private void LabelMethod(Android.Content.Context con)
{
TextView textView = new TextView(con);
textView.LayoutParameters = new LinearLayout.LayoutParams((int)(width * 0.95), (int)(30 * density));
textView.Hint = " AutoComplete";
textView.TextSize = 18;
mainLayout.AddView(textView);
}
private void AutoCompleteMethod(Android.Content.Context con)
{
SfAutoComplete diacriticAutoComplete = new SfAutoComplete(con);
diacriticAutoComplete.LayoutParameters = new LinearLayout.LayoutParams((int)(width * 0.95), (int)(50));
diacriticAutoComplete.SetGravity(GravityFlags.Center);
diacriticAutoComplete.DisplayMemberPath = "SongTitle";
diacriticAutoComplete.DataSource = new MusicInfoRepository().GetMusicInfo();
diacriticAutoComplete.MaximumDropDownHeight = 150;
diacriticAutoComplete.Watermark = "Search here";
diacriticAutoComplete.SuggestionMode = SuggestionMode.Contains;
diacriticAutoComplete.TextHighlightMode = OccurrenceMode.MultipleOccurrence;
diacriticAutoComplete.DropDownItemHeight = 40;
diacriticAutoComplete.IgnoreDiacritic = false;
mainLayout.AddView(diacriticAutoComplete);
}
}
}