namespace WrapPanelDemo
{
public partial class SearchMediPage : ContentPage, INotifyPropertyChanged
{
public ObservableCollection<Person> TempPersonsList = new ObservableCollection<Person>();
public SearchMediPage()
{
//Persons = new ObservableCollection<Person>();
InitializeComponent();
BindingContext = this;
bindMedicionData();
// slNewItem.IsVisible = false;
}
public void bindMedicionData()
{
TempPersonsList.Add(new Person { Name = "sivakodna"});
TempPersonsList.Add(new Person { Name = "venugopal"});
TempPersonsList.Add(new Person { Name = "chiranjeevi"});
TempPersonsList.Add(new Person { Name = "venu"});
TempPersonsList.Add(new Person { Name = "venkatrao"});
TempPersonsList.Add(new Person { Name = "venkatraosas"});
TempPersonsList.Add(new Person { Name = "venkatraosa"});
TempPersonsList.Add(new Person { Name = "sudhaka"});
TempPersonsList.Add(new Person { Name = "venkatrao"});
TempPersonsList.Add(new Person { Name = "chinnapa"});
//TempPersonsList = _Persons.ToList();
//_Persons.Clear();
lbxMedicionsList.IsVisible = false;
}
public void searchTabletName(Object sender, TextChangedEventArgs e)
{
string strMedicionName = e.NewTextValue.ToLower().ToString();
//var medicionsList = (from s in objMedicionsList where s.MedicionName.Contains(strMedicionName) select s).ToList();
// objMedicionsList.Clear();
if (strMedicionName.Length > 0)
{
var medicionsList = (from s in TempPersonsList where s.Name.StartsWith(strMedicionName) select s).ToList();
if (medicionsList.Count > 0)
{
_Persons.Clear();
foreach (var eachItem in medicionsList)
{
_Persons.Add(eachItem);
}
OnPropertyChanged("Persons");
// slNewItem.IsVisible = false;
lbxMedicionsList.IsVisible = true;
}
else
{
_Persons.Clear();
OnPropertyChanged("Persons");
// slNewItem.IsVisible = true;
lbxMedicionsList.IsVisible = false;
}
}
}
private ObservableCollection<Person> _Persons = new ObservableCollection<Person>();
public ObservableCollection<Person> Persons
{
get { return _Persons; }
set
{
if (_Persons == value)
return;
_Persons = value;
OnPropertyChanged("Persons");
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
{
public partial class SearchMediPage : ContentPage, INotifyPropertyChanged
{
public ObservableCollection<Person> TempPersonsList = new ObservableCollection<Person>();
public SearchMediPage()
{
//Persons = new ObservableCollection<Person>();
InitializeComponent();
BindingContext = this;
bindMedicionData();
// slNewItem.IsVisible = false;
}
public void bindMedicionData()
{
TempPersonsList.Add(new Person { Name = "sivakodna"});
TempPersonsList.Add(new Person { Name = "venugopal"});
TempPersonsList.Add(new Person { Name = "chiranjeevi"});
TempPersonsList.Add(new Person { Name = "venu"});
TempPersonsList.Add(new Person { Name = "venkatrao"});
TempPersonsList.Add(new Person { Name = "venkatraosas"});
TempPersonsList.Add(new Person { Name = "venkatraosa"});
TempPersonsList.Add(new Person { Name = "sudhaka"});
TempPersonsList.Add(new Person { Name = "venkatrao"});
TempPersonsList.Add(new Person { Name = "chinnapa"});
//TempPersonsList = _Persons.ToList();
//_Persons.Clear();
lbxMedicionsList.IsVisible = false;
}
public void searchTabletName(Object sender, TextChangedEventArgs e)
{
string strMedicionName = e.NewTextValue.ToLower().ToString();
//var medicionsList = (from s in objMedicionsList where s.MedicionName.Contains(strMedicionName) select s).ToList();
// objMedicionsList.Clear();
if (strMedicionName.Length > 0)
{
var medicionsList = (from s in TempPersonsList where s.Name.StartsWith(strMedicionName) select s).ToList();
if (medicionsList.Count > 0)
{
_Persons.Clear();
foreach (var eachItem in medicionsList)
{
_Persons.Add(eachItem);
}
OnPropertyChanged("Persons");
// slNewItem.IsVisible = false;
lbxMedicionsList.IsVisible = true;
}
else
{
_Persons.Clear();
OnPropertyChanged("Persons");
// slNewItem.IsVisible = true;
lbxMedicionsList.IsVisible = false;
}
}
}
private ObservableCollection<Person> _Persons = new ObservableCollection<Person>();
public ObservableCollection<Person> Persons
{
get { return _Persons; }
set
{
if (_Persons == value)
return;
_Persons = value;
OnPropertyChanged("Persons");
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
No comments:
Post a Comment