private static void DateTimePropertyChanged(BindableObject bindable, object oldValue, object newValue) { DetailedCell cell = (DetailedCell)bindable; Device.BeginInvokeOnMainThread(() => { if (newValue != null && !string.IsNullOrWhiteSpace(newValue.ToString())) { DateTimeConverter converter = new DateTimeConverter(); string date = newValue.ToString().Split(' ')[0]; string time = newValue.ToString().Split(' ')[1]; int day = int.Parse(date.Split('/')[0]); int month = int.Parse(date.Split('/')[1]); int year = int.Parse(date.Split('/')[2]); int hour = int.Parse(time.Split(':')[0]); int minute = int.Parse(time.Split(':')[1]); int second = int.Parse(time.Split(':')[2]); object fdt = converter.Convert(new DateTime(year, month, day, hour, minute, second), typeof(string), null, CultureInfo.CurrentCulture); cell.DateTimeLabel.Text = fdt.ToString(); } else { cell.DateTimeLabel.Text = ""; } if (string.IsNullOrWhiteSpace(newValue.ToString())) { Grid.SetRowSpan(cell.TitleLabel, 2); } else { Grid.SetRowSpan(cell.TitleLabel, 1); } }); }
static void CellImageSourcePropertyChanged(BindableObject bindable, object oldValue, object newValue) { DetailedCell cell = (DetailedCell)bindable; Device.BeginInvokeOnMainThread(() => { cell.Image.Source = (ImageSource)newValue; }); }
static void ImageURLPropertyChanged(BindableObject bindable, object oldValue, object newValue) { DetailedCell cell = (DetailedCell)bindable; Device.BeginInvokeOnMainThread(() => { cell.Image.Source = newValue?.ToString(); }); }
static void TitlePropertyChanged(BindableObject bindable, object oldValue, object newValue) { DetailedCell cell = (DetailedCell)bindable; Device.BeginInvokeOnMainThread(() => { cell.TitleLabel.Text = newValue?.ToString(); }); }
static void IsNewPropertyChanged(BindableObject bindable, object oldValue, object newValue) { DetailedCell cell = (DetailedCell)bindable; bool isNew = (bool)newValue; Device.BeginInvokeOnMainThread(() => { cell.NewLabelContainer.IsVisible = isNew; cell.NewLabel.IsVisible = isNew; cell.TitleLabel.FontAttributes = isNew ? FontAttributes.Bold : FontAttributes.None; cell.View.BackgroundColor = isNew ? Color.FromHex("#f2f7ea") : Color.Transparent; }); }
static void SubtitlePropertyChanged(BindableObject bindable, object oldValue, object newValue) { DetailedCell cell = (DetailedCell)bindable; Device.BeginInvokeOnMainThread(() => { cell.SubtitleLabel.Text = newValue.ToString(); if (string.IsNullOrWhiteSpace(newValue.ToString())) { Grid.SetRowSpan(cell.TitleLabel, 2); } else { Grid.SetRowSpan(cell.TitleLabel, 1); } }); }
private static void TextAnnotationPropertyChanged(BindableObject bindable, object oldValue, object newValue) { DetailedCell cell = (DetailedCell)bindable; Device.BeginInvokeOnMainThread(() => { //cell.TextAnnotationLabel.Text = (newValue == null ? string.Empty : newValue.ToString()); if (newValue == null || string.IsNullOrWhiteSpace(newValue.ToString())) { Grid.SetRowSpan(cell.TitleLabel, 2); } else { Grid.SetRowSpan(cell.TitleLabel, 1); } }); }
private static void DatePropertyChanged(BindableObject bindable, object oldValue, object newValue) { DetailedCell cell = (DetailedCell)bindable; Device.BeginInvokeOnMainThread(() => { //cell.DateLabel.Text = newValue.ToString() == string.Empty ? string.Empty : newValue.ToString().Split(' ')[0]; if (string.IsNullOrWhiteSpace(newValue.ToString())) { Grid.SetRowSpan(cell.TitleLabel, 2); } else { Grid.SetRowSpan(cell.TitleLabel, 1); } }); }
private static void TimePropertyChanged(BindableObject bindable, object oldValue, object newValue) { DetailedCell cell = (DetailedCell)bindable; Device.BeginInvokeOnMainThread(() => { cell.DateTimeLabel.Text = newValue.ToString() == string.Empty ? string.Empty : newValue.ToString().Split(' ')[1]; if (!string.IsNullOrEmpty(cell.DateTimeLabel.Text) && cell.DateTimeLabel.Text.Contains(":")) { cell.DateTimeLabel.Text = cell.DateTimeLabel.Text.Split(':')[0] + ':' + cell.DateTimeLabel.Text.Split(':')[1]; } if (string.IsNullOrWhiteSpace(newValue.ToString())) { Grid.SetRowSpan(cell.TitleLabel, 2); } else { Grid.SetRowSpan(cell.TitleLabel, 1); } }); }
static void SwipeDeleteCommandPropertyChanged(BindableObject bindable, object oldValue, object newValue) { DetailedCell cell = (DetailedCell)bindable; cell.SwipeDelete.Command = (ICommand)newValue; }
static void TappedCommandPropertyChanged(BindableObject bindable, object oldValue, object newValue) { DetailedCell cell = (DetailedCell)bindable; cell.ParentViewCell.Tapped += (EventHandler)newValue; }