Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How can i change selected date, ok and cancel buttons background color? #22

Open
usharanin26 opened this issue Dec 11, 2024 · 10 comments

Comments

@usharanin26
Copy link

Question: How can i change selected date, ok and cancel buttons background color?

@sebarslan
Copy link
Owner

Hello @usharanin26,

You can use ToolButtonsStyle, SelectedDayStyle styles for this.

Best Regards

@usharanin26
Copy link
Author

Hi @sebarslan,

Can you please give me an example, I did try to add below style as SelectedDayStyle. It didn't work

var customDatePickerStyle = new Style(typeof(NullableDateTimePickerOptions))
{
Setters =
{
new Setter { Property = NullableDateTimePicker.BackgroundColorProperty, Value = Colors.Yellow }
}
};

@mshenoy83
Copy link

This is how we've done it we added a new style

            <Style x:Key="CalendarToolButtonStyle" TargetType="Button">
                <Setter Property="MinimumWidthRequest" Value="70" />
                <Setter Property="FontSize" Value="12" />
                  <Setter Property="FontFamily" Value="{DynamicResource PrimaryFontMedium}"/>
            </Style>

And then added it to the NullableDatePickerOptions.
NullableDatePickerOptions.DayStyle = (Style)newValue;
And then use it when opening the datepicker
await NullableDateTimePicker.OpenCalendarAsync(NullableDatePickerOptions);

@usharanin26
Copy link
Author

Thank you, got it. new Style(typeof(Button)) did the job

@sebarslan
Copy link
Owner

sebarslan commented Dec 13, 2024

I'm glad you solved the problem.

You can also do it this way.

<Style x:Key="CalendarToolButtonStyle" TargetType="Button">
    <Setter Property="MinimumWidthRequest" Value="70" />
    <Setter Property="FontSize" Value="12" />
    <Setter Property="FontFamily" Value="{DynamicResource PrimaryFontMedium}"/>
</Style>
            
<ndtp:NullableDateTimePicker NullableDateTime="{Binding MyDateTime}" ToolButtonsStyle="{StaticResource CalendarToolButtonStyle}" />

Best Regards

@usharanin26
Copy link
Author

Thank you and one last question,
on clicking the year on the calendar popup, years are showing from minimum year and I'd have to scroll all the way to current year to select. How to make it show years from current year and all the way to minimum year?

@sebarslan
Copy link
Owner

I'll try to add this to the next version

@usharanin26
Copy link
Author

calendar pop-up is not working for iOS

@sebarslan
Copy link
Owner

Hi @usharanin26
I will check this and make it work in the new version.
Thanks und Best Regards

@sebarslan
Copy link
Owner

sebarslan commented Dec 30, 2024

Hi @usharanin26

Can you check if version 2.4.0 works on ios?

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants