0
votes

In Xamarin Forms there is a TimePicker control. I can instantiate the control from my xaml code and bind the Time property to a property on my view model.

I would like to create a similar control for selecting days of the week ("Monday", "Tuesday", etc). Let's call it DaysOfWeekPicker. DaysOfWeekPicker should allow the user to select zero, one or multiple (up to 7) days. This is different to the standard Picker which only allows exactly one item to be selected.

I've found tutorials which explain how to create custom controls with native renderers defined for each platform. However, as a first pass, I would be happy to implement DaysOfWeekPicker using just the other controls that already exist in Xamarin Forms such as buttons and labels. Is there a way I can do this without creating new renderers for each platform?

1

1 Answers

1
votes

You can achieve this by adding a ContentView to your project

Xamarin Add ContentView

Your ContentView can have a XAML file which you can use to define its looks or you can do that in the code behind

Take a look at Bindable Properties (especially about property change events) and Behaviors and investigate how they work. You will likely need to write some code to define how your control works, moves, responds, validates etc.