private ObservableCollection<object> selectionobject = new ObservableCollection<object>();
public ObservableCollection<object> SelectionObject
{
get { return selectionobject; }
set
{
selectionobject = value;
RaisepropertyChanged("SelectionObject");
}
}
private string text;
public string Text
{
get
{
return text;
}
set
{
text = value;
if (text != null && text.Length > 0)
{
GetData(text);
}
else
{
//ValidationColor = Color.Red;
//ErrorMessage = "Please enter valid 6 digits PinCode : 600001 or 600100";
}
RaisepropertyChanged("ItemsSource");
}
}
#endregion
#region Constructor
public ViewModel()
{
}
#endregion
public ObservableCollection GetValidData(ObservableCollection obj)
{
return obj;
}
#region Methods
public async void GetData(string cityCode)
{
RestService restservice = new RestService();
ItemsSource = await restservice.RefreshDataAsync(cityCode);
GetValidData(ItemsSource);
if (ItemsSource.Count <= 0)
{
//ValidationColor = Color.Red;
//ErrorMessage = "No area available";
}
}
void RaisepropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
}
public class StringToColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value.ToString() == "_DeliveryStatus")
{
return Color.SkyBlue;
}
return Color.Red;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}