danheron / Heron.MudCalendar

Calendar component for MudBlazor
MIT License
149 stars 30 forks source link

Cannot assign custom item to the MudCalendar Items Parameter #140

Closed ansab490 closed 2 months ago

ansab490 commented 2 months ago

Hi,

First of all thank you for building this component. I am currently ripping out the pure JS calendar for this as this is so much easier to integrate and use.

However, I ran in to problem with custom content and I think this might be a bug

As per the documentation, we can create custom content to be displayed in cell. The approach is to create a class that needs to inherit from CalendarItem and then a cell template needs to be defined. I followed to exact approach, but I couldn't find new properties in the .razor class.

On investigation, I found out that the MudCalendar Items Parameter is not defined as IEnumerable(T) but rather as IEnumerable(CalendarItem) as shown below:

MudCalendar Items

This means that no matter what kind of class I give it. It doesn't matter.

Can you please have a look at this in your spare time?

P.S. If its me who is doing something wrong please let me know

Kind Regards Ansab

danheron commented 2 months ago

Have you looked at the documentation? The 'Custom Content' example shows how to do this.

I'm not sure what your problem is. If you could show your code that isn't working then maybe I can be of more help.

ansab490 commented 2 months ago

Yup followed the documentation word by word. Created a class, that inherits from CalendarItem class. Added 2 extra properties Color and Text2 when I assign that to the Items property in the mud calendar the new properties doesn't show up in .razor file. Only the properties defined in the CalendarItem come up

ansab490 commented 2 months ago

Alright, I will close this issue. I have no idea, what is happening. I tried yesterday, it was not working for me. Today, I just did it all again and its working. I am sorry about that, maybe I missed out on something yesterday. Sorry for that