ME-MarvinE / XCalendar

A plugin for .NET providing an API for representing a calendar along with fully customisable calendar controls for Xamarin Forms and .NET MAUI
MIT License
300 stars 36 forks source link

Unable to select individual days in the calendar #122

Closed mardausdennis closed 1 year ago

mardausdennis commented 1 year ago

Describe the bug Hello! I hope you are doing well. I wanted to reach out to you because I am having an issue with the calendar in my app. I am unable to select individual days in the calendar. When I click on a date, I hear a “pop” sound, but it is not selected. I have implemented the Models folder with all the events, downloaded the PropertyChanged.Fody Nuget package, and added the BaseViewModel. I believe that I have followed all the necessary steps, but I am still having this issue.

Expected behavior I should be able to select individual days in the calendar by clicking on them.

Steps to reproduce OR link to code

Xamarin Forms or .NET MAUI (If related to UI) NET MAUI

Additional context (Optional) I have implemented the Models folder with all the events, downloaded the PropertyChanged.Fody Nuget package, and added the BaseViewModel.

As a reference to my project, please see my Github repo: https://github.com/mardausdennis/ReservationmoduleDisApp24/tree/main/app/DisApp24/DisApp24.

ME-MarvinE commented 1 year ago

Hi,

Adding x:Name="This" to the page makes everything work as expected:

In the samples, there are bindings which use Source={x:Reference This} in order to escape the local binding context and reference the binding context of the page. These bindings look for a VisualElement with x:Name="This" but this is not defined anywhere in "CalendarPage.xaml", so these bindings fail silently.

You can identify these errors by looking at the Output window in debug mode. Here's an example of one from your repo: [0:] Microsoft.Maui.Controls.Xaml.Diagnostics.BindingDiagnostics: Warning: 'BindingContext' property not found on 'Microsoft.Maui.Controls.Xaml.ReferenceExtension', target property: 'XCalendar.Maui.Views.DayView.CurrentMonthCommand'

There is also a reference to a namespace that does not exist in your solution and may throw errors when attempting to use it: xmlns:ViewModels="clr-namespace:XCalendarMauiSample.ViewModels.

Unrelated, but every time I see XCalendar.Maui used in an actual app I'm reminded of the disappointment I felt when I first observed its terrible speed after porting the plugin to .NET MAUI.

Thanks for using XCalendar.

mardausdennis commented 1 year ago

You are the G.O.A.T. Thanks for your insanely quick response and thanks for noticing my silly error. Do you maybe have a patreon or something of that kind?

ME-MarvinE commented 1 year ago

No, I don't. I looked into GitHub sponsors but couldn't figure that out, maybe Patreon would be easier.

Always happy to help.