Giter Club home page Giter Club logo

xamforms.controls.calendar's Introduction

PLEASE NOTE: This repository is deprecated and will no longer be maintained.


Calendar Control Plugin for Xamarin.Forms

A simple Calendar control for your Xamarin.Forms projects

Setup

In your iOS, Android, and Windows projects call:

Xamarin.Forms.Init();//platform specific init
XamForms.Controls.<PLATFORM>.Calendar.Init();

You must do this AFTER you call Xamarin.Forms.Init();

IMPORTANT: I you are having problems like: When Changing Months, the days do not update properly in, try adding this to your projects AssemblyInfo.cs:

[assembly:Xamarin.Forms.Platform.<Platform>.ExportRenderer(typeof(XamForms.Controls.CalendarButton), typeof(XamForms.Controls.<Platform>.CalendarButtonRenderer))]

Troubleshoot

Usage

Here is a sample:

new Calendar
{
  BorderColor = Color.Gay,
  BorderWidth = 3,
  BackgroundColor = Color.Gay,
  StartDay = DayOfWeek.Sunday,
  StartDate = DateTime.Now
}

XAML:

First add the xmlns namespace:

xmlns:controls="clr-namespace:XamForms.Controls;assembly=XamForms.Controls.Calendar"

Then add the xaml:

<controls:Calendar Padding="10,0,10,0" StartDay="Monday" SelectedBorderWidth="4" DisabledBorderColor="Black" />

Documentation: Wiki

Contributors

License

https://github.com/rebeccaXam/XamForms.Controls.Calendar/blob/master/LICENSE

xamforms.controls.calendar's People

Contributors

k232 avatar luccasclezar avatar rebeccaxam 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xamforms.controls.calendar's Issues

Android Special Date Background

I have already contacted you about this, but your solution didn't seem to work.

This is how it looks like:
screenshot 2017-06-06 11 04 52

Even after adding calendar.RaiseSpecialDatesChanged() to my code after the special dates are added.

Thank you in advance for your attention.

Is there a way to select only one date in a whole calendar control which has multiple months added in a year.

Current functionality:

  1. If I have added 5 months in a calendar, I can select 5 different dates at one point of time(One date in each month). Date selection is provided month wise.

Do we have any option, so that if one date is selected in a calendar control(all other selected dates in other months also get deselected)

Requirement: Only one date should be selected in whole calendar control irrespective of date selected in different months.

Calendar Button Template Not updating.

Hi,

I'm trying to update the CalendarButton template on an action, visually it is not getting updated unless the user click that button.
Is there any visual update method which I can call to update the template of calendar button on an action?

Add Calendar Use Description

Add documentation on Wiki for iOS platform to add "NSCalendarsUsageDescription" ("Privacy - Calendars Usage Description") before submitting your app to the App Store or it will be rejected during processing time.

When Changing Months, the days do not update properly

image
(Start Month)
image
(End Month)

When I navigate from month to month, the days do not update properly. For example, I started in August of 2016, and the Dates/Days are correct. However, when I use the navigation arrow to go to the month of July, the days are not correct. July 13th for example, should be on a Wednesday but it is not.

Disable selection, other than SpecialDates

Not sure if this component supports this or not, but in my particular case, I'd need something like this.

Essentially, just disable selection by default, then enable manually for each SpecialDate.

EDIT: I tried setting SelectedDate to DateTime.MinValue, in hopes of quickly deselecting dates that aren't allowed, but I guess it doesn't support two way binding, or something else is blocking it.

Set start date

Hi.

I am trying to set the starting date in the calendar but I am not successful, the intention is to disable the dates below the current one.
I used StartDate and it did not work. For example, i want disable dates before 21/09/2017.
I'm running the XamForms.Controls.Calendar version "version =" 1.0.7 "

11

Disallow to show dates outside Min Max Daterange

Many thanks for this great plugin!

One question: Is it possible to restrict the scrolling to the Min and Max Daterange? So when I set e.g. Min to 1st January 2017 and Max to 20th March 2017, user should only be able to see January, February and March. If on January, the left back button should be disabled. Is that possible? Currently users could go back to whatever date. Of course they are greyed out, but I want to avoid user to switch outside the date range.

Many thanks!

SelectedDate and StartDate not working

Hi! I'm trying to deal with a problem with databinding using this calendar control.

this is how my xaml code looks:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:controls="clr-namespace:XamForms.Controls;assembly=XamForms.Controls.Calendar"
             x:Class="PGapp.View.Wydarzenia.WydarzeniaKalendarz">
  <controls:Calendar SelectedDate="{Binding Datee}" DateCommand="{Binding DateChosen}" Padding="10,0,10,0" StartDay="Monday" SelectedBorderWidth="4" DisabledBorderColor="Black" BackgroundColor="White"/>
</ContentPage>

and viewmodel:

class WydarzeniaKalendarzVM : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        public void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        private DateTime _Datee;
        public DateTime Datee
        {
            get
            {
                return _Datee;
            }
            set
            {
                _Datee = value;
                NotifyPropertyChanged("Datee");
            }
        }
        public ICommand DateChosen { get; set; }

        
        public WydarzeniaKalendarzVM(INavigation navigation)
        {
            DateChosen = new Command(DateChosenCmd);
        }

        public void DateChosenCmd()
        {
            DateTime aaa = Datee;
        }
    }

the problem is that SelectedDate is always returning Date 01.01.0001. Am I doing something wrong?

(of course the binding is set in WydarzeniaKalendarz.xaml.cs file:
this.BindingContext = new WydarzeniaKalendarzVM(this.Navigation);

Random null reference exception

Every now and again my app throws the following exception on launch.

  at Xamarin.Forms.BindableObject.GetContext (Xamarin.Forms.BindableProperty property) [0x00013] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:489 
  at Xamarin.Forms.BindableObject.GetValue (Xamarin.Forms.BindableProperty property) [0x0000e] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:54 
  at XamForms.Controls.Calendar.get_DatesFontSize () [0x00000] in <b9a77dab63a24ffd9c36ae26640eec47>:0 
  at XamForms.Controls.Calendar.FillCalendarWindows () [0x000b5] in <b9a77dab63a24ffd9c36ae26640eec47>:0 
  at XamForms.Controls.Calendar.<FillCalendar>m__3 () [0x00000] in <b9a77dab63a24ffd9c36ae26640eec47>:0 
  at System.Threading.Tasks.Task.InnerInvoke () [0x00012] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2879 
  at System.Threading.Tasks.Task.Execute () [0x00016] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2502 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at XamForms.Controls.Calendar+<OnParentSet>c__async0.MoveNext () [0x0008b] in <b9a77dab63a24ffd9c36ae26640eec47>:0 
--- End of stack trace from previous location where exception was thrown ---
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:79 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:63 
  at App.iOS.Application.Main (System.String[] args) [0x00008] in /Users/dids/Work/Xamarin/App/iOS/Main.cs:17 

Amount of days in a month are incorrect

The amount of days in a month that's displayed is always 31, no matter the month. The "DaysNotInMonth" is not correctly displayed either; for quite a lot of months, the days that are in "the next month" range from the 26th to the 2nd. For some months, days of the next month are in the current month (1st and 2nd of the next month, mostly) (see attached screenshots).

screen shot 2016-10-04 at 09 08 04
screen shot 2016-10-04 at 09 08 28
screen shot 2016-10-04 at 09 08 51
screen shot 2016-10-04 at 09 14 12

SpecialDates background doesn't update when changing month

Hello,

Thanks a lot for your component. When using this plug in, I found out that whenever I change the current month to next month or previous month, the special dates backgrounds in the current month still appear in the same spots in next month or previous month even though there are no special dates in next month or previous month. Could you please show me how to resolve this?

Thanks in advance.

SpecialDates not showing with Binding

I'm using MVVMLight for Bindings, and in the AttendancesPage.xaml I have:

<controls:Calendar x:Name="Calendar" SpecialDates="{Binding Attendances}" 
	Padding="10,0,10,0" 
	StartDay="Sunday" 
	SelectedBorderWidth="1" 
	DisabledBorderColor="Black">
</controls:Calendar>

Using my AttendanceViewModel, with the following code:

#region Private Fields
private ObservableCollection<SpecialDate> attendances;
#endregion

#region Dependency Properties
private const string AttendancesPropertyName = "Attendances";
#endregion

#region Properties
public ObservableCollection<SpecialDate> Attendances
{
	get { return attendances; }
	set { Set(AttendancesPropertyName, ref attendances, value); }
}
#endregion

#region Private Fields
private readonly IWorkoutService workoutService;
private readonly UserModel authUser;
#endregion

#region Constructor
public AttendanceViewModel(IWorkoutService workoutService, UserModel authUser)
{
	this.workoutService = workoutService;
	this.authUser = authUser;
}
#endregion

#region IPageLifecicleEvents
public async Task OnAppearing()
{
	IsBusy = true;

	var dates = new List<SpecialDate>();

	var specialDate = new SpecialDate(new DateTime(2017, 03, 13));
	specialDate.BackgroundColor = Color.Green;
	specialDate.TextColor = Color.White;

	dates.Add(specialDate);

	Attendances = new ObservableCollection<SpecialDate>(dates);

	IsBusy = false;
}
#endregion

When I set Attendances property, the Calendar doesn't change. If I use the same OnAppearing method on AttendancesPage.xaml.cs, it works...

How can I use Binding to show SpecialDates on Calendar?

Labels not completely visible

Labels and buttons are not displayed properly because a part of them is cut off. This is more evident in the UWP platform, but also in Android the day labels are not completely visible. Here are two screenshots:

2017-05-10 wp_ss_20170509_0001

new Feature show number of week

Hi i've added your calendar to my app and i love it!!! will you improve it with the number of the week? i need this functionality . thank you very much

SelectedBackgroundColor and SelectedTextColor in XAML

Using either option in XAML results in this runtime message:

Cannot assign property "SelectedBackgroundColor": Property does not exists, or is not assignable, or mismatching type between value and property.

or

Cannot assign property "SelectedTextColor": Property does not exists, or is not assignable, or mismatching type between value and property.

How can I set the selected background and text colour?

How can I get the first day displayed?

I need to get events to fill the calendar, how can I know which is the date of the first day in the calendar? Even if it is gray, as in, not from the month being displayed? At the same time, how can I get the last day being displayed?

screenshot 2017-05-31 15 17 00

Image for clarification.

Thanks in advance for the amazing tool you have developed.

Feature: Make note text

How I can make a text note for each day? like the question #32 easy to usefully. And the text note can binding with string of array on view model. And we can insert a small images. The image under show you how can we do?

example

Multiple dates can be selected when MultiSelect=false

There's one weird procedure you can follow to cause multiple dates to be selected on the same screen even when this is supposedly disabled:

  1. Set MultiSelectDates=false
  2. Select a date in a month which will NOT be visible when you switch forward to the following month (Nov 15 2016)
  3. Switch to the following month (December)
  4. Select a date which will be visible in the preceding month (Dec 2nd 2016)
  5. Switch back to the preceding month (November)
  6. See that both Nov 15 2016 and Dec 2 2016 are selected

Double selected dates

It looks like this is probably caused by not clearing out the SelectedDates when a new month is picked out. If that were done it would also prevent different months from showing their own individual selected dates as happens right now, which seems like unintended behavior. However, I do like that when you have for example Dec 2 2016 selected while you're viewing the month of Nov, if you switch over to December view Dec 2 2016 remains selected, which might get broken by my fix. I'm getting a little confused in lines 796-811 of Calendar.xaml.cs though but I'll come back to look at this later.

Pluging has a IOS minimun compatibility in iphone?

First we want to say thanks for this great plugin.
We test the application with this pluging on a iPhone 4 with IOS 7 and the application crash when loads de calender.
The questions is if exists a mínimum version of OS in iphone for this pluging.

increase cell height

How i can increase calendar cell height in xamarin forms..?
i am stuck in that point .
please guide me..

Is there a way to deselect a date?

Hello, awesome control, thankyou.

Currently my app/calender does not allow to select previous dates from the current day. I display an alert to notifiy that the user is not allow to select previous dates.. I have Multiple select enabled to true. Once the dialog is closes the date is still selected and the background color is set to red.

I would like to deselect the the date and not have the background color in that date cell.

is there a way to deselect a date from c#

thanks

Possible bug: Selected Date

Hi Rebecca, thanks for the brilliant control.
I think there may be an issue with initially selecting a date for the control.
When initializing the control if a date is selected (today's date for example)...
Firstly, when the page opens, there is no highlight on the selected date (not sure if this was intentional or not).
Secondly, if the same date (today's date) is selected (by clicking on it) it becomes highlighted, This is not too bad, but the control's Selected Date property has now become null.
After this, selecting/unselecting the same date, the logic seems fine.
I have tested on Android and Windows Universal and the issue is the same.
Please let me know if you need any more information.
Thanks again.

feature request: bindable property to set CalendarWeekRule

XamForms.Controls.Calendar/Calendar.NumberOfWeek.cs

var weekNum = ciCurr.Calendar.GetWeekOfYear(start, CalendarWeekRule.FirstFourDayWeek, StartDay);


The week labels are set by default to CalendarWeekRule.FirstFourDayWeek.
I couldn't find a way to set the calenderweekrule to first full week.

Dateselected event is triggered twice when selecting few calendar dates in a calendar control

When I am using 5 different calendar controls to display more than once calendar month, I have implemented your suggestion using the calendar view model to select only one date at a time in all the calendar controls. I am facing one new issue in android devices. Sometimes Date Clicked event is hitting twice on selecting few dates in a given month. For February 2016, when selecting the dates from1st Feb 2016 to 6th Feb, DateClicked event is triggered twice, where as from Feb 7th to 27th 2016 is triggered only once.
Note: I am seeing this issue after implementing Calendar view model for selecting only one date at a time in all the calendar controls. This is in reference to #25

Random Crashes on Android // Xamarin.Forms

Hello,

sometimes I get completely random crashes, the problem is that I can't debug them or fix them because I have no clue where to start.
Here's a StackTrace from Mobile Center.

Xamarin.Forms / happens only on Android.

ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource)
List`1+Enumerator[T].MoveNextRare ()
List`1+Enumerator[T].MoveNext ()
Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate, System.Boolean& found)
Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate)
Calendar+<ChangeCalendar>c__AnonStorey7.<>m__0 ()
Thread+RunnableImplementor.Run ()
IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this)
(wrapper dynamic-method) System.Object:71e19f9c-e626-431a-8741-76f2e9d766a8 (intptr,intptr)

Does anyone experience something like this?

SpecialDate not displayed

I have added a calendar to my XAML code (Xamarin.Forms on Android project), and in the constructor for the page I add several SpecialDates to the list. I have also tried to add them in the OnAppearing function with the same effect.

When the calendar is initially drawn the dates are not highlighted.

BUT, if I click to another month and back again they are shown highlighted correctly.
Also if I click on a date that I know it in the list it is highlighted correctly.

Any ideas?

Edit: Using the NuGet package v1.0.5

SelectedDay = DateTime.Today - do not change to actual month, in case I am in another monty

Hi, thank you for great calendar!
I am trying to create something like "Today" Button. Everything works fine, if actual date is loaded on screen, means I am on actual month, or on previous/next month and actual day is still visible (is part last/first week of month).
Is there any chance to create some method, which will switch month to actual month, and Select today date?

If this functionality is already in your package and I am just only blind, let me know, how to achieve this behavior.

Thanks a lot

jslady

Change TextLabel

Hello, I need to change textlabel.
It is possible to change "May 2017" by May? thank you very much

Calendar Header Styling

Hi,
Is it possible to change the calendar header style. We tried, but couldn't change only the header style, rest all other background, textcolor etc.. can be changed.

Missing references

Hi,

I installed the component (v.1.0.3) with NuGet from Visual Studio 2015 Update 3, adding it to all projects in a Xamarin Forms (v.2.3.0.107) solution, but there are some issues:

  • when running on Windows 10 either the UWP or Win8.1 projects, I get the following error: WinRT information: Cannot locate resource from ‘ms-appx:///XamForms.Controls.Calendar.UWP/Resources.xaml’.
  • the XamForms.Controls.Calendar.iOS isn't added to the iOS project. I had to add it manually to the references. I don't have a MAC at hand at the moment, so not sure if it's due to that.

I downloaded the code, updated to Xamarin Forms 2.3.0.107, and ran the sample and it works fine on Windows 10. Droid version also runs fine on Android device.

P.S. Also a note on the XAML sample in readme: shouldn't it say "<controls:Calendar Padding=..." instead of "<controls:CalendarControl Padding=" ?

Change color Arrows change moths

Hi.
Firstly thanks for developing this lib which is useful for my application.

I wonder if it is possible to change the color of the arrows that change the calendar months, is currently red.

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.