public ICommand OnAppointmentLoadedCommand { get { return new Command<AppointmentLoadedEventArgs>((args) => { var test4 = args.Bounds; if (args.appointment is BNScheduleAppointment) { var loadedAppointment = (BNScheduleAppointment)args.appointment; ExtendedBNButton appointmentButton = new ExtendedBNButton() { Text = loadedAppointment.Subject, TextColor = Color.Black, BorderWidth = 2, BorderRadius = 2, BorderColor = Color.Red, BackgroundColor = loadedAppointment.Color, VerticalContentAlignment = TextAlignment.Center, HorizontalContentAlignment = TextAlignment.Start, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Command = OnAppointmentTappedCommand, CommandParameter = args.appointment as BNScheduleAppointment, }; //var test = args.Bounds.Size.Height; //var test2 = args.Bounds.Size.Width; //appointmentButton.HeightRequest = args.Bounds.Height; //appointmentButton.WidthRequest = args.Bounds.Width; // todo add more if (loadedAppointment.IsGroup) { appointmentButton.Image = "Group.png"; } args.view = appointmentButton; } }); } } |
Hi Luuk,
Thank you for update.
Based on the provided information, we have checked your requirement of positioning the CustomView of ScheduleAppointment in the OnAppointmentLoaded event in Xamarin Forms (iOS). As per the behavior, CustomView will not positioned based on given height in the View and it can be achieved by setting Margin to CustomView add in the ParentView. For example, if you are setting “Button” as a CustomView, you can add the Button in the StackLayout and by setting Margin to the Button you can positioned the Button based on your requirement. Please refer the below code,
[c#]
button.Text = "click"; button.HeightRequest = 40;
|
If the given solution doesn’t meet your requirement, could you please revert us back with more information about your query? It will be helpful for us to analyze on it and provide you a better solution.
Regards,
Subburaj Pandian V.
Hi Luuk,
Thank you for the update.
We have checked your requirement of Setting the CustomView to the entire Appointment in Android and it can be achieved by setting Bounds Width and Height to the CustomView Width and Height. Please refer the below code example,
[c#]
if (Device.OS == TargetPlatform.Android)
|
In the previous update we have provided code example for setting CustomView within the Appointment in iOS, could you please check this solution and let us know, if you have any further query on this.
Regards,
Subburaj Pandian V.
Hey,I have tried your solution with the args.bound.width etc.This does not work it will size the appointment to sizes beyond the bounds.Here's a screenshot of the result:
Hi Luuk,
Thank you for the update.
We have checked the mentioned query with setting CustomView to the ScheduleAppointment using Schedule OnAppoitmentLoaded event in Xamarin Forms (Android). As per the behaviour of button in Xamarin, button has default padding and the border radius is 5. So that while setting button as CutsomView it has not occupying entire size for rendering. It can be resolved by setting negative padding (-10) to the Button, please refer the below code example.
[c#] button.Margin = new Thickness(-10, -10, -10, -10);
|
If the given solution doesn’t meet your requirement, could you please revert us by modifying the provided sample with more information about your query? It will be helpful for us to analyze on it and provide you a better solution.
Regards,
Subburaj Pandian V.
Hi Luuk,
We have checked, the provided code example has resolved the issue with setting CustomView size to the ScheduleAppointment using Schedule OnAppoitmentLoaded event in Xamarin Forms (Android) and we are unable to reproduce the issue from our side. We have prepared sample based on this scenario, please find the below sample,
Sample link: Appointment_CustomView
In the sample, We have ScheduleAppointments and set the CustomView as Button in the StackLayout in OnAppointmentLoaded event, and it has occupying the entire size of the Appointment. We have attached screenshot of the output along with the sample.
If the given sample doesn't meet your required scenario, could you please revert to us by modifying the provided sample with more information (device details if the sample meet your requirement), it will be helpful for us to check on it and provide you the better solution.
Regards,
Subburaj Pandian V