Git Product home page Git Product logo

xcalendar's Introduction

XCalendar

A plugin for .NET providing a Calendar API and DateTime extensions.

UI controls are available for Xamarin Forms and .NET MAUI.

Features include:

  • Ability to use the Calendar from code without referencing a UI framework.
  • Ability to use and reference your own models by implementing ICalendarDay.
  • Ability to set the number of rows shown or have it be automatic.
  • Ability to change the start of the week to any day of the week.
  • Ability to select single, multiple or a range of dates.
  • Ability to restrict navigation to a range of dates and define how the calendar loops.
  • Ability to specify your own custom order of days of week at any length, with support for duplicates and non-chronological orders.
  • Fully customisable CalendarView with custom controls, templates, and exposed default commands.
  • Support for localising text (such as days of the week and day numbers).
  • And more!

Examples in the sample app include:

Duolingo Streak Calendar

Official App Sample App

Event Calendar

Custom DatePicker Dialog

Selection

Using DayView

Customising A Day

Animated Swipable Calendar

Animated.Swipable.Calendar.mp4

Connecting Selected Days

xcalendar's People

Contributors

bls-lisa-bowden avatar janausch avatar me-marvine avatar scheidtdav avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xcalendar's Issues

Let events or selections visually span across multiple days

Is your feature request related to a problem? Please describe.
Related to either events or the multi-select calendar configuration

Describe the solution you'd like
Would it be possible to have selections visually span like this instead of as separate circles? Or maybe is there a way to enable this for our app now?
image

Describe alternatives you've considered
Writing my own calendar control, or maybe SyncFusion's calendar.

Maui iOS Release Build throws XamlParseException

Describe the bug
Showing normal XCalendar Events Calendar with navigation view as shown in the sample in my app's home page
I am trying to share the ios release build to testers, when opening the appication, app throws xaml parse exception

Issue Title
Microsoft.Maui.Controls.Xaml.CreateValuesVisitor.Visit(ElementNode node, INode parentNode)
Microsoft.Maui.Controls.Xaml.XamlParseException: Position 48:33. Cannot assign property "Property": Property does not exist, or is not assignable, or mismatching type between value and property

Stacktrace
Microsoft.Maui.Controls.Xaml.CreateValuesVisitor.Visit(ElementNode node, INode parentNode)
Microsoft.Maui.Controls.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
Microsoft.Maui.Controls.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
Microsoft.Maui.Controls.Xaml.RootNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
Microsoft.Maui.Controls.Xaml.XamlLoader.Visit(RootNode rootnode, HydrationContext visitorContext, Boolean useDesignProperties)
Microsoft.Maui.Controls.Xaml.XamlLoader.Load(Object view, String xaml, Assembly rootAssembly, Boolean useDesignProperties)
Microsoft.Maui.Controls.Xaml.XamlLoader.Load(Object view, String xaml, Boolean useDesignProperties)
Microsoft.Maui.Controls.Xaml.XamlLoader.Load(Object view, Type callingType)
Microsoft.Maui.Controls.Xaml.Extensions.LoadFromXaml[CalendarView](CalendarView view, Type callingType)
XCalendar.Maui.Views.CalendarView.InitializeComponent()
XCalendar.Maui.Views.CalendarView..ctor()
WccMobileApp.Views.HomePage.InitializeComponent()
WccMobileApp.Views.HomePage..ctor()
WccMobileApp.MainPage.InitializeComponent()
WccMobileApp.MainPage..ctor()
WhiteCup.Views.LoginPage.OnLoginClicked(Object sender, EventArgs e)

Expected behavior
Events Calendar must be shown in the home page without any crash

Steps to reproduce OR link to code
This crash is not happening in debug mode
only happens when i try to build the app in the release mode

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

Device Info (Optional)
Device Model: iPhone SE (3rd Generation)
IOS Version: 16.3

Example App has dates jumbled up

``Describe the bug
In trying the Xamarin Forms sample app (click on the specific examples like "Selection example") on my Android, the dates are mixed up on the calendar view. It seems maybe the weekends are what are mixed up.

Expected behavior
The calendar dates should display in order as expected unless customized to not be.

Steps to reproduce OR link to code
Try the sample Xamarin Forms app on Android. Haven't tried iOS.

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

Additional context (Optional)

Device Info (Optional)
Device Model: Google pixel 6 pro
Android Version: Android 13
IOS Version:
Windows Version:

Weird appearance on IOS

I'm comparing Android and iOS(14.4.2 Iphone 8 plus) layout side by side, and here is how they look:

image

image

The funniest thing is that when I turn the phone to horizontal, it fix the problem, then when I turn back to vertical again, it keep the layout problem fixed! How can I solve this? I'm using the simplest code sample that I found on github docs:

<StackLayout>
        <xcViews:CalendarView
            x:Name="CalendarViewElement" 
         Days="{Binding Calendar.Days}"
        DaysOfWeek="{Binding Calendar.DayNamesOrder}"
        NavigatedDate="{Binding Calendar.NavigatedDate}"
         DayNameHorizontalSpacing="1"
        />
</StackLayout>

UPDATE

Simulating on iphone 13(ios 15)

At first moment:

Captura de Tela 2022-09-09 às 18 49 31

After turn to horizontal:

Captura de Tela 2022-09-09 às 18 49 41

Back again to vertical:

Captura de Tela 2022-09-09 às 18 49 57

Invalid dates lost after navigating months

Describe the bug
I set invalid dates on page load. The dates are showing the invalid color as expected. When I navigate to a different month and return, the invalid color is gone and I can select them.

Expected behavior
The invalid property should still be set regardless of navigation

Steps to reproduce OR link to code
Set invalid dates. Then navigate away and come back. Invalid dates will be gone.

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

Additional context (Optional)

Device Info (Optional)
Device Model: Google Pixel Pro 6
Android Version: 13
IOS Version:
Windows Version:

Upgrading from version 3 to 4 breaks the application

**
I have tried to upgrade from version 3 to 4 to use the EVENT CALENDAR and now I get error on field that don have a arefrance anymore

for example

<views:CalendarView x:Name="xCalendar" Grid.Row="6" SelectionType="Single" DayRangeMinimumDate="{Binding Today}" IsVisible="false" SelectionAction="Modify" />

while I have this import as required:

xmlns:views="clr-namespace:XCalendar.Maui.Views;assembly=XCalendar.Maui"

will yield error on:

ItemPage.xaml.cs(55, 27): [CS1061] 'CalendarView' does not contain a definition for 'SelectedDates' and no accessible extension method 'SelectedDates' accepting a first argument of type 'CalendarView' could be found (are you missing a using directive or an assembly reference?)

and so does DayRangeMinimumDate and SelectionAction with the same error
**

Everything needs to be working, the upgrade alone breaks the application, when I change the nugget back to version 3 everything works ok

the problem is on .NET MAUI app

running on m1 MacBook Pro and 2 different pc's trying to build with rider on Mac and visual studio on pc

thanks in advance

Day Background Color

Love this project!!! Fantastic - Thank You!!!

I can't find the code or method to change the background color of the selected day or (range of dates).

I see in the example the Red oval like rectangle (awesome) - Is there a method so that I can use a different color or shape for selected background. Or where is that code, and I can help add to the functionality. Thanks ....

Update: png added: Referencing - Change color of circled red background colors.
xCalendarGitHub1

Unable to select individual days in the calendar

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

  • Open the app.
  • Navigate to the Calendar tab.
  • Try to select a date by clicking on it.
  • Note that the date is not selected, even though you hear a “pop” sound.

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.

Passing DateTime of a day in viewmodel to make more control for background changing

Hello, i have a problem with some logic, how can i pass here DateTime of a day instead static one 9-2-2023 ?

<xc:CalendarView.DayTemplate>
                <DataTemplate x:DataType="{x:Type xcModels:CalendarDay}">
                    <Border
                        Margin="2.5"
                        BackgroundColor="{Binding BindingContext.ObservableParameters[9-2-2023], Source={x:Reference This},

or how i can make it in c#?

new CalendarView{ VerticalOptions = LayoutOptions.Start}
				.Bind(CalendarView.DaysProperty, static(WorkDayViewModel vm) => vm.Calendar.Days)
				.Bind(CalendarView.DaysOfWeekProperty, static(WorkDayViewModel vm) => vm.Calendar.DayNamesOrder)

i can't make children of it and this solution is faster i think

Unable to see Dates on Calendar on .Net Maui

Describe the bug
Pretty much followed the steps onto the wiki and can't get the calendar dates to be shown onto the UI. Just shows the header which is white and occupies space (because of the vertical options)

Expected behavior
Show calendar view with dates.

Steps to reproduce OR link to code
Please pull this Repository for reproduction of the bug

Xamarin Forms or .NET MAUI (If related to UI)
Using .Net Maui, I have set the background as aqua just for debugging purposes.
calendar

Additional context (Optional)
Latest plugin version (4.2.0)
Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.4.2

Device Info (Optional)
Android Version: OS 12/API 31 (Simulator)
Windows Version: 10.0.22621 Build 22621

How to add and refresh events during runtime?

First of all I would like to thank you @ME-MarvinE for the great work!

I cant figure out how to add new events. I had make a minimal example from the EventCalendarExample.
As you can see the event gets listetd but not marked in the calendar.
Screenshot 2022-06-13 191741

image

Add Unit Tests

  • Easier to test new and existing features
  • Identify and fix bugs easier
  • Easier to contribute.

NavigationViewTemplate Property Not Found

Describe the bug
UI Fails to load when attempting to create a control Template via the NavigationViewTemplate Property in Xaml.

Expected behavior
Able to create a control Template via the NavigationViewTemplate Property in Xaml.
Steps to reproduce OR link to code

                <xc:CalendarView
                    x:Name="MyCally"
                    Days="{Binding Calendar.Days}"
                    DaysOfWeek="{Binding Calendar.DayNamesOrder}"
                    NavigatedDate="{Binding Calendar.NavigatedDate}">
                    <xc:CalendarView.NavigationViewTemplate>
                        <ControlTemplate>
                            <Label Text=" asdfasdfasdf" />
                        </ControlTemplate>
                    </xc:CalendarView.NavigationViewTemplate>
                </xc:CalendarView>

Xamarin Forms or .NET MAUI (If related to UI)
Xamarin.Forms
Additional context (Optional)
Occurs in XCalendar.Forms 4.2.0 works fine in XCalendar.Forms 4.0.0 and 4.1.0
Device Info (Optional)
Device Model:
Android Version:
IOS Version:
Windows Version:
Screenshot 2022-11-17 at 9 16 09 AM

Calendar view in maui causes crash on physical android device

Describe the bug
When including a CalendarView in a maui android app the app crashes, presumably because the calendar view is taking so long to load. My app is running fine (but noticeably slowly) on an android emulator but as soon as I install it on a physical device it crashes.

Expected behavior
Calendar view renders without crash

Steps to reproduce OR link to code
Repro project: https://github.com/sfoslund/DailyCheckinApp/blob/main/DailyCheckinApp/Views/CalendarView.xaml#L17

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

Device Info (Optional)
Device Model: Google Pixel 4A
Android Version: 12
IOS Version: N/a
Windows Version: N/a

Page does not load if CalendarView's IsVisible property is set.

Hi there,

I seem to be having a problem on IOS where if I set the IsVisible property on CalendarView, the ContentPage hosting it will not load. My intention was to control the property from a view model, but I couldn't even get that far. Simply setting the property with the literal "False" repros the issue.

I can't speak for Android as I have not tested on it.

Expected behaviour
I expect the CalendarView to be loaded on its host page and appear/disappear accordingly depending on how the IsVisible property has been set.

Steps to reproduce OR link to code
I have tried this with a new AppShell tabbed project and a new App Project.

Repro steps for the AppShell project are:

  1. Simply create a new AppShell Project.
  2. Create a MyCalendar Property in one of the ViewModels of the tab pages (I chose the ItemsViewModel VM)
  3. Add the CalendarView control on the ItemsPage.xaml (I did so verbatim from the getting-started page).
  4. Include an IsVisible property to the control in the Xaml.
  5. Run the project and when the app comes up, try selecting the Items tab and it hangs the app.

I have attached the sample AppShell project.
xCalendarTest.zip

Both tests use the simple example shown on the XCalendar's getting-started page repeated below:

VM
public Calendar<CalendarDay> MyCalendar { get; set; } = new Calendar<CalendarDay>();

XAML

        <views:CalendarView
            IsVisible="False"   <----- Problem
            Days="{Binding MyCalendar.Days}"
            DaysOfWeek="{Binding MyCalendar.DayNamesOrder}"
            NavigatedDate="{Binding MyCalendar.NavigatedDate}"/>

Test details:
Platform: Xamarin Forms (5.0.0.2662)
Calendar (4.6.0)
Tested Device: iPhone 15 Pro Max (IOS 17.4 & 17.2)

XCalendar.Maui 4.4.2 works when debugging, crashes at startup when installed on android phone

Greetings!

After successfully implementing this amazing control and trying to test it on my phone (Realme 8 Pro with Android 13)
The program crashes at startup after installation.

The program works just fine in the emulator when debugging, but when changing to release and trying to manually install the app into my android phone, the program installs fine, however when starting the program up, the .net maui splashscreen appears and then app instantly crashes without any error.

I have tried using a clean project from scratch, same problem persists.
Is there any tip or anything i could do to make it run on a android phone?

Devices and OS Versions:
Realme 8 Pro:
Android 13:
Windows Version: 11 Pro, 22h2 (custom built pc)
Visual Studio 2022 17.6.1 .NET 7

Thanks in advance for all your help!

MAUI support

Are you planning to migrate this project to MAUI?

Set localize manual

I'd like to set localize for navigation and DayOfWeek manually. It's seem not implement this feature.

DaySelectedBackgroundColor - Circle not Rendering

Describe the bug

Hi there!

Thanks for all the work you put into XCalendar!

I think I might be experiencing a bug in setting the color value for the dot that indicates the currently selected date.

Looking at the Sample Code it looks to me like it should be set on the cx:DayView - where you assign it to a Color value.

I've done that like so:

<xc:DayView
    ...
    SelectedBackgroundColor="{StaticResource DaySelectedBackgroundColor}"
    ...
    >
</xc:DayView>

And then set the resource in App.xaml like

<Application.Resources>
    ...
    <Color x:Key="DaySelectedBackgroundColor">Green</Color>
    ...
</Application.Resources>

However, the selected indicator still does not populate. Screenshot:
xcalendarissue

Are there other properties that I need to set to enable this feature?

Expected behavior

I would think there should be a green dot when selecting on a day.

Steps to reproduce OR link to code

I've uploaded my current code to this repo / branch

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

.NET MAUI

Additional context (Optional)

Device Info (Optional)
Device Model: samsung galaxy s20 FE
Android Version: 12, One UI version 4.1
IOS Version:
Windows Version:

FEATURE REQUEST: Badge Support

Is your feature request related to a problem? Please describe.

Describe the solution you'd like
I'd love the ability to add a BadgeView to each calendar item. Effectively I'd like to add icons or numbers to specific dates in order to glean more information at a glance. The badge view should be bound to an interface IBadgeView { DateTimeOffset Date{ get; } } where the required value is the date and the concretion can have arbitrary data that is bound to the SelectorTemplate of the BadgeView

Describe alternatives you've considered

Additional context (Optional)

Use Case 1:
Creating multiple entries in a database for a given date, It would be nice to be able to put the "Entry Count" as a numeric value on the calendar for that date.

Use Case 2:
An entry for a given date has a state (let's use "yes" and "no" for this example). It would be nice to be able to display a ✔️ or an ❌ on the calendar for that date.

Maybe we need add net8.0 framework to maui library.

I have a maui project that has unit tests. To have unit tests, the maui project has to support net-8. You can learn more about this here: https://youtu.be/C9vIDLQwc7M?t=169

We have to add to the maui library, the net8 framework. This solution is inspired by how this library does it: https://github.com/hjam40/Camera.MAUI/blob/master/Camera.MAUI/Camera.MAUI.csproj.

Any alternative?

Now, by default, If you have unit tests and add XCalendar, it adds conditions in the csproj like this:

`

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-ios'">
  <PackageReference Include="XCalendar.Maui">
    <Version>4.5.3</Version>
  </PackageReference>
</ItemGroup>

`

Also if you don't hide the using of xcalendar in #if Android, it will fail to run the tests.

@ME-MarvinE . If you see this as a good solution. I can do it myself.

Android Crash on EventCalendar open in Release Mode

Describe the bug
I am having a strange bug where the App crashes when I open the view with the calendar in it. The behavior only occured when I build the app on Android in release mode. In Debug mode and on windows I didn't had that bug.
I don't know what caused this issue but the app worked fine with the last nuget and VS version.

Expected behavior
The Calendar shows up like in Debug Mode or on windows.

Steps to reproduce OR link to code
That's the tricky part. I tried the build with the sample apps in your repo and couldn't reproduce it. Your sample apps work fine.

Xamarin Forms or .NET MAUI (If related to UI)
.Net MAUI with .NET Core 7 in Visual Studio 2022 v17.5.1

Device Info (Optional)
Device Model: Pixel 5 Emulator and Nokia X20
Android Version: 13
Windows Version: 19045.2604

Systemlog

03-10 14:12:23.459 pixel_5_-_api_33 Error 5071 AndroidRuntime android.runtime.JavaProxyThrowable: Microsoft.Maui.Controls.Xaml.XamlParseException: Position 16:14. Type System:Boolean not found in xmlns clr-namespace:System;assembly=mscorlib
at Microsoft.Maui.Controls.Xaml.CreateValuesVisitor.Visit(ElementNode node, INode parentNode)
at Microsoft.Maui.Controls.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
at Microsoft.Maui.Controls.Xaml.ListNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
at Microsoft.Maui.Controls.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
at Microsoft.Maui.Controls.Xaml.RootNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
at Microsoft.Maui.Controls.Xaml.XamlLoader.Visit(RootNode rootnode, HydrationContext visitorContext, Boolean useDesignProperties)
at Microsoft.Maui.Controls.Xaml.XamlLoader.Load(Object view, String xaml, Assembly rootAssembly, Boolean useDesignProperties)
at Microsoft.Maui.Controls.Xaml.XamlLoader.Load(Object view, String xaml, Boolean useDesignProperties)
at Microsoft.Maui.Controls.Xaml.XamlLoader.Load(Object view, Type callingType)
at Microsoft.Maui.Controls.Xaml.Extensions.LoadFromXaml[CalendarView](CalendarView view, Type callingType)
at XCalendar.Maui.Views.CalendarView.InitializeComponent()
at XCalendar.Maui.Views.CalendarView..ctor()
at MyAPP.Views.MyKalender.InitializeComponent()
at MyAPP.Views.MyKalender..ctor()
at MyAPP.Views.MyStartPage.KalenderToolbarItem_Clicked(Object sender, EventArgs e)
at System.Threading.Tasks.Task.<>c.b__128_0(Object )
at Android.App.SyncContext.<>c__DisplayClass2_0.b__0()
at Java.Lang.Thread.RunnableImplementor.Run()
at Java.Lang.IRunnableInvoker.n_Run(IntPtr , IntPtr )
at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V , IntPtr , IntPtr )
at mono.java.lang.RunnableImplementor.n_run(Native Method)
at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:31)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Shadow on iOS Navigation Arrows

There is a shadow under the navigation buttons on iOS. To make it more in line with Android I think those should be disabled or at least have an option to toggle it for people

image

Implement Custom EventArgs

For instance on the DateSelectionChanged it would be great to have a custom event args object that would automatically tell me the date that was selected, or maybe even also the old and the new date.

The mentioned event is just an example, maybe there are more events that could have similar event args objects.

iOS Sample App Custom Day Names Order Doesn't Seem to Work

I'm trying to set the Custom Day Names Order in the sample app on iOS, but it doesn't seem to select the option on the left side and therefore I am not able to add anything else than Mondays. Which in turn causes some weird behavior in the calendar if I actually do add 4 Mondays 😄

image

Month Translations?

Hello, thx for u'r work,
is there a way to manually translate month's names?

Navigation arrows not shown

Describe the bug
Left and Right arrows icon shown on some android devices but refuse to show on other devices, its shows "n" and "ni" instead of "←" and "➝"
Expected behavior
It should show "←" and "➝" correctly
Steps to reproduce OR link to code

<ContentPage.Content>

<xcViews:CalendarView />

Xamarin Forms or .NET MAUI (If related to UI)
XF
Additional context (Optional)

Device Info (Optional)
Device Model:
Android Version:
IOS Version:
Windows Version:

SelectionAction as None

Hi,
is there something like SelectionAction as None?
I would like a Calendar which has no ability to add/remove/modify/replace the entries. More likly just have a couple of SelectedDates and when you select one a action executes.
What I have tried:
When I set SelectionType as None I obviously cannot select any date.

I just want to select Date only from my SelectedDates (ItemSource).

Assigning templates to selected individual days

Hi,

I've been playing around with XCalendar and it's been fun so far.

My consideration is to use it for an event manager. Everything that I need has been sorted out, but there's one thing that I'm struggling with. Is there a way to change individual days' templates based on certain conditions e.g. a list of dates? The reason is that I'd like to display a simple frame on days that have events scheduled. So far I've been able to get the frame to display based on properties within the CalendarDayView (e.g. IsCurrentMonth, IsEnabled etc.) but I seem to need a way to access it from code, which I haven't been able to figure out.

What I am trying right now is using a template selector but I realize this might not be a viable approach.

Please excuse me if this is a simple question as I am relatively new to Xamarin. Great project btw!

<ContentPage.Resources>
        <DataTemplate x:Key="eventCalendarDayViewTemplate"
                      x:DataType="{x:Type xcModels:CalendarDay}">
            <xc:CalendarDayView x:Name="dayCalendar"
                                TodayTextColor="Orange"
                                TodayBorderColor="Transparent"
                                TodayBackgroundColor="Transparent"
                                CornerRadius="10"
                                CalendarView="{Binding ., Source={x:Reference MyCalendar}}"
                                DateTime="{Binding DateTime}"
                                SelectedBackgroundColor="Transparent"
                                SelectedTextColor="Black"
                                ControlTemplate="{StaticResource CalendarViewControlTemplate}">
            </xc:CalendarDayView>
        </DataTemplate>
        <DataTemplate x:Key="genericCalendarDayViewTemplate"
                      x:DataType="{x:Type xcModels:CalendarDay}">
            <xc:CalendarDayView x:Name="dayCalendar"
                                TodayTextColor="Orange"
                                TodayBorderColor="Transparent"
                                TodayBackgroundColor="Transparent"
                                CornerRadius="10"
                                CalendarView="{Binding ., Source={x:Reference MyCalendar}}"
                                DateTime="{Binding DateTime}"
                                SelectedBackgroundColor="Transparent"
                                SelectedTextColor="Black">
            </xc:CalendarDayView>
        </DataTemplate>
        <ControlTemplate x:Key="CalendarViewControlTemplate">
            <Grid>
                <ContentPresenter Margin="0,0,0,5" />
                <Frame x:Name="SelectedEventIndicator"
                       IsVisible="{TemplateBinding IsEnabled}"
                       Margin="0"
                       Padding="0"
                       CornerRadius="100"
                       HasShadow="False"
                       HeightRequest="6"
                       HorizontalOptions="Center"
                       VerticalOptions="End"
                       WidthRequest="20"
                       BackgroundColor="#4ABC5F">
                </Frame>
            </Grid>
        </ControlTemplate>
        <selector:CalendarDayTemplateSelector x:Key="calendarDayTemplateSelector"
                                              EventCalendarDayViewTemplate="{StaticResource eventCalendarDayViewTemplate}"
                                              GenericCalendarDayViewTemplate="{StaticResource genericCalendarDayViewTemplate}" />
    </ContentPage.Resources>
    <StackLayout>
        <Frame Margin="25"
               Padding="0"
               CornerRadius="10"
               HasShadow="False"
               BorderColor="Transparent"
               BackgroundColor="Transparent">
            <StackLayout>
                <xc:CalendarView x:Name="MyCalendar"
                                 BackgroundColor="WhiteSmoke"
                                 NavigationBackgroundColor="#4ABC5F"
                                 SelectionType="Single"
                                 SelectionAction="Replace"
                                 DateSelectionChanged="CalendarView_DateSelectionChanged"
                                 DayTemplate="{StaticResource calendarDayTemplateSelector}">
                </xc:CalendarView>
            </StackLayout>
        </Frame>
        <StackLayout>
            <Frame Margin="25"
                   Padding="0"
                   CornerRadius="10"
                   HasShadow="False"
                   BorderColor="Transparent"
                   BackgroundColor="Transparent">
                <Label x:Name="lblDateSelected"
                       FontSize="30"
                       TextColor="DarkGray"
                       Text="Test text"
                       HorizontalOptions="Center" />
            </Frame>
        </StackLayout>
    </StackLayout>

Custom Selection Shows Blank on iOS (Sample App)

If I use the custom selection template for dates the dates will go blank when I select something. On Android I see a red circle. Reporting this for the sample app, but there might be a deeper problem here where this functionality is not working correctly for iOS

image

Day Text Color Option

Hello, and Thank You! for such an Awesome project!!!

I am trying to make the XCalendar Have a "Dark Theme" - Black Background, white Text,

Please forgive me as I am not good at Xamarin, and have spent the last couple days trying to create a
<xc:CalendarDayView.Style>
That does this, But I cant get it.

I know on the App.xaml this property changes all the Labels Text
<Color x:Key="ContentTextColor">White</Color>
(Note - This does not work for me in my own code)

I am sure this is a simple oversite on my part - I apologize (Noob here). Can someone point me in the right direction to solve this property.?

And is there a better place to post these questions? (I hate taking the developers time away for this basic programming questions).

Thanks - Love this project -Great Job!

(Would like White Text Here on Images below.)

capture1

capture2

Avalonia version/port ?

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Avalonia version

Describe alternatives you've considered

Additional context (Optional)

Maui app with XCalendar crashes on startup when ran on Windows

Describe the bug
Maui app with XCalendar crashes on startup when ran on Windows.
Expected behavior
No crash
Steps to reproduce OR link to code
Implement XCalendar.Maui into file new MAUI sample app. Run on Windows Machine.
Repo

Xamarin Forms or .NET MAUI (If related to UI)
.NET MAUI
Additional context (Optional)
image

Device Info (Optional)
Device Model:
Android Version:
IOS Version:
Windows Version: 10.0.19044 Build 19044

Animated Swipable Calendar example doesn't work properly on Windows

Describe the bug
The Calendar doesn't update the date. It only goes -1 current month and +1 current month then just loops.

Expected behavior
Updates the navigated date based on which way you scroll.

Steps to reproduce OR link to code
Run the sample app on Windows and go to 'Animated Swipable Calendar' example

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

Device Info (Optional)
Device Model:
Android Version:
IOS Version:
Windows Version: 10.0.19044 Build 19044

Add a SelectCommand property

Hi, first thanks a lot for your work on this plugin, it works very well!
I just would like to submit a feature for it to go even further.

Description 📜

Currently, there is no way to trigger a Command when we select a date and recently I needed to use one.

XCalendar.Forms 4.1.0 starts with empty template

XCalendar.Forms 4.1.0 starts with empty template. Shouldn't it start with the calendar of the current month?

Steps to reproduce:

1 - Install XCalendar.Forms nuget package
2 - Add xmlns:xcViews="clr-namespace:XCalendar.Forms.Views;assembly=XCalendar.Forms" into Xaml file
3 - Add the Calendar View:

Code behind:

public Calendar<CalendarDay> Calendar { get; set; } = new Calendar<CalendarDay>();

Xaml

<StackLayout>
   <xcViews:CalendarView HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" 
   BackgroundColor="Brown"  />   
</StackLayout>

Also tried to add these params

Days="{Binding Calendar.Days}" DaysOfWeek="{Binding Calendar.DayNamesOrder}" NavigatedDate="{Binding Calendar.NavigatedDate}" 

I have tried it on android and ios but the result is a calendar view presenting two navigation rows with the current month name and the year. Just that, no rows, no columns, no days.

Type "xc:CalendarView" was not found

Describe the bug
I've added the package, in the viewmodel everthing is fine, but when I go to the xaml file, it tells me that the type xc:CalendarView could not be found. I've added "xmlns:xc="clr-namespace:XCalendar.Maui.Views;assembly=XCalendar.Maui"" but the error remains.
Expected behavior
Can use xc:CalendarView normally

Steps to reproduce OR link to code
Downloaded packave via "Manage NuGet packages for solution
Searched for "XCalendar.Maui"
Version 4.4.2 was installed
Added using XCalendar.Core.Models; and public Calendar MyCalendar { get; set; } = new Calendar(); to viewmodel along with NavigateCalendar functions.
Now go to xaml file, add xmlns:xc="clr-namespace:XCalendar.Maui.Views;assembly=XCalendar.Maui and use xc:CalendarView to create a calendar.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.