private void Schedule_AppointmentLoaded(object sender, AppointmentLoadedEventArgs e) { if (e.Appointment.Subject == "Checkup") { UIImageView hospitalImage = new UIImageView(); hospitalImage.Image = UIImage.FromFile("Images/Hospital.png"); hospitalImage.Frame = new CGRect(50, 35, 50.0f, 50.0f); UIStackView stackPanel = new UIStackView(); stackPanel.Frame = new CGRect(0, 0, 100, 50); stackPanel.Add(hospitalImage); e.AppointmentStyle.TextStyle = UIFont.FromName(@"Arial", 16); e.AppointmentStyle.TextColor = UIColor.White; e.View = stackPanel; } else { UIImageView familyImage = new UIImageView(); familyImage.Image = UIImage.FromFile("Images/family.png"); familyImage.Frame = new CGRect(50, 35, 50.0f, 30.0f); UIStackView stackPanel = new UIStackView(); stackPanel.Frame = new CGRect(0, 0, 100, 30); stackPanel.Add(familyImage); e.AppointmentStyle.TextStyle = UIFont.FromName(@"Arial", 16); e.AppointmentStyle.TextColor = UIColor.White; e.View = stackPanel; } }
private void SfSchedule_AppointmentLoaded(object sender, AppointmentLoadedEventArgs e) { customView = new Button(mContext); customView.Text = e.Appointment.Subject; customView.TextAlignment = TextAlignment.Gravity; customView.Gravity = GravityFlags.CenterHorizontal; customView.SetTextColor(Color.White); customView.SetPadding(10, 20, 10, 20); if (customView.Text == "B'Day Party") { customView.SetCompoundDrawablesWithIntrinsicBounds(0, Resource.Drawable.family, 0, 0); customView.SetBackgroundColor(Color.ParseColor("#FFA2C139")); } else if (customView.Text == "Medical Checkup") { customView.SetCompoundDrawablesWithIntrinsicBounds(0, Resource.Drawable.hospital, 0, 0); customView.SetBackgroundColor(Color.ParseColor("#FFD80073")); } else { customView.SetCompoundDrawablesWithIntrinsicBounds(0, Resource.Drawable.team, 0, 0); customView.SetBackgroundColor(Color.ParseColor("#FF1BA1E2")); } e.View = customView; }
void Schedule_OnAppointmentLoadedEvent(object sender, AppointmentLoadedEventArgs args) { Button button = new Button(); button.TextColor = Color.White; if (Device.OS == TargetPlatform.iOS || Device.OS == TargetPlatform.Android) { if (args.appointment.Subject == "Family") { button.BackgroundColor = (Color.FromHex("#FFD80073")); button.Text = "Jeni's B'Day Celebration"; button.Image = "family.png"; } else if (args.appointment.Subject == "CheckUp") { button.BackgroundColor = Color.FromHex("#FFA2C139"); button.Text = "Check Up"; button.Image = "Hospital.png"; } args.view = button; } }