This example demonstrates how to specify custom native Android and iOS views for cells and appointments of the Month View. To do this, implement view providers and register these implementations in each platform project.
To run the application:
- Obtain your NuGet feed URL.
- Register the DevExpress NuGet feed as a package source.
- Restore all NuGet packages for the solution.
-
Create the CustomCellViewProvider.cs and CustomAppointmentViewProvider.cs classes that implement the ICachedViewProvider interface and define custom view providers for cells and appointments. These classes contain methods that reduce a view's creation and load time:
- RequestViewFromCache - before creating a view, checks whether the cache already contains it. If it does, it loads the existing view. If a view cannot be returned from the cache, the CreateNewView method creates a new view (an instance of the CustomCellView.cs or CustomAppointmentView.cs class that inherits ViewGroup).
- BindView - binds a view to data.
- RecycleView - adds a view to the cache.
- Recycle - clears the cache.
-
In the MainActivity.cs file, register a custom service that inherits the MonthViewProviderService class and override the CreateCellViewProvider and CreateAppointmentViewProvider methods to use custom view providers for cells and appointments.
-
Create the CustomCellViewProvider.cs and CustomAppointmentViewProvider.cs classes that implement the IViewProvider interface and define custom view providers for cells and appointments. These classes have the following methods:
- RequestView - returns a view from the cache, if any, otherwise creates a new view (an instance of the CustomCellView.cs or CustomAppointmentView.cs class that inherits UIView).
- BindView - binds a view to data.
- RecycleView - adds a view to the cache.
-
In the AppDelegate.cs file, register a custom service that inherits the MonthViewProviderService class and override the CreateCellViewProvide and CreateAppointmentViewProvider methods to use custom view providers for cells and appointments.