2
votes

I'm using the Xamarin Forms 3.6 material visual. I have a contentpage with both Entry and DatePicker controls. Entry renders a placeholder great - however, a datepicker does not appear to have an option for a placeholder/title/label.

Looking to see if anyone else has come across this? Will this be a custom renderer?

2

2 Answers

2
votes

You will have to create CustomRenderer I'm afraid. But there is nothing bad with it, there is a good guide of how to solve this sort of problem.

Hope this helps!

0
votes

Here's how I did it following Klein's advice:

<Grid RowDefinitions="30, 35">
    <DatePicker Date="{Binding DateTo, Mode=TwoWay}"
                Grid.Row="1"
                Margin="0, -35, 0, 0"
                VerticalOptions="Center"
                HorizontalOptions="Start"
                WidthRequest="200"
                Format="dd-MMM-yyyy"
                TextTransform="Uppercase"
                FontSize="Body" />
     <Label Text="To" 
            Grid.Row="0"
            Margin="12, 10, 0, 0"
            Style="{StaticResource LabelCaption}" />
 </Grid>

Output:

DatePicker Placeholder in Xamarin Forms