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

Paterns on special dates and special date Selection #81

Open
ambsenyestudi opened this issue Jun 25, 2018 · 4 comments
Open

Paterns on special dates and special date Selection #81

ambsenyestudi opened this issue Jun 25, 2018 · 4 comments

Comments

@ambsenyestudi
Copy link

Hello, great control.
I have an scenario on which there is only one month, but I need patterns on my special dates.
When selecting a special date that has a list of patterns as BackgroundPattern, some times said selected special date turns its background to white, loosing the pattern.
I wasn't capable of pin pointing the exact ocurrance, It's a bit random.
How can I fix it?

@pantelisGeo90
Copy link

Hello.
I've noticed the same behaviour (only tested on Android).
It looks like the selected date background color overrides the backgroundPattern.
I've tried setting the SelectedBackgroundColor to Default or Transparent but it still overrides the backgroundPattern of the selected date.

By looking the code a bit it looks like (i think) the BackgroundPattern is being overridden by the default background color when a user selects a date.

button.BackgroundColor = SelectedBackgroundColor != Color.Default ? SelectedBackgroundColor : (special != null && special.BackgroundColor.HasValue ? special.BackgroundColor.Value : defaultBackgroundColor);

@FranRDev
Copy link

Hello.

I have the same problem.

Any solution?

@FranRDev
Copy link

FranRDev commented Oct 1, 2019

I fixed it moving the assignment of BackgroundPattern at the end.

protected void SetButtonSelected(CalendarButton button, SpecialDate special) {
    Device.BeginInvokeOnMainThread(() => {
        button.BackgroundImage = special != null ? special.BackgroundImage : null;
        var defaultBackgroundColor = button.IsOutOfMonth ? DatesBackgroundColorOutsideMonth : DatesBackgroundColor;
        var defaultTextColor = button.IsOutOfMonth ? DatesTextColorOutsideMonth : DatesTextColor;
        var defaultFontAttributes = button.IsOutOfMonth ? DatesFontAttributesOutsideMonth : DatesFontAttributes;
        var defaultFontFamily = button.IsOutOfMonth ? DatesFontFamilyOutsideMonth : DatesFontFamily;
        button.IsEnabled = true;
        button.IsSelected = true;
        button.FontSize = SelectedFontSize;
        button.BorderWidth = SelectedBorderWidth;
        button.BorderColor = SelectedBorderColor;
        button.BackgroundColor = SelectedBackgroundColor != Color.Default ? SelectedBackgroundColor : (special != null && special.BackgroundColor.HasValue ? special.BackgroundColor.Value : defaultBackgroundColor);
        button.TextColor = SelectedTextColor != Color.Default ? SelectedTextColor : (special != null && special.TextColor.HasValue ? special.TextColor.Value : defaultTextColor);
        button.FontAttributes = SelectedFontAttributes != FontAttributes.None ? SelectedFontAttributes : (special != null && special.FontAttributes.HasValue ? special.FontAttributes.Value : defaultFontAttributes);
        button.FontFamily = !string.IsNullOrEmpty(SelectedFontFamily) ? SelectedFontFamily : (special != null && !string.IsNullOrEmpty(special.FontFamily) ? special.FontFamily : defaultFontFamily);
        button.BackgroundPattern = special != null ? special.BackgroundPattern : null;
    });
}

@lubiepomaranczki
Copy link

@KerosenoDev can you make a pull request to this repository so we can get it fixed?

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

4 participants