1. Home
  2. Docs
  3. DatePicker by Bitsplash
  4. Marking dates on the date picker

Marking dates on the date picker

Sometime we would like to mark certain dates on the date picker. For example add a small dot to indicate the date is scheduled for a meeting:


The date picker comes with built in functionality for that. Here is how it can be done:

1.Edit the marker in the cell template

the cell template represents a single cell in the date picker grid. the first step is to position the Mark object in the position you would like it to be. For the sake of this example , it is the top left corner


2. Assign the marker sprite to the cell template

click the cell template object and assign a sprite to it (it will override the sprite in the mark object)

3.Use the built in methods to assign colors to dates

DatePicker.Content.SetMarkerColor(DateTime.Now, Color.red); // sets the color of the specified date
DatePicker.Content.ClearMarker(DateTime.Now); // clears the marker from the specified date
DatePicker.Content.ClearMarkerColor(); // clears all markers
DatePicker.Content.SetAllMarkerColors(dictionary); // sets marker colors in a batch. This is a good optoin if you want to change a lot of markers at once