Giter Club home page Giter Club logo

Comments (8)

pradeeparutla avatar pradeeparutla commented on July 2, 2024

calendar_datesselected_differentmonths

I want only one date to be selected at a time. As in the image attached. total of two dates are selected in the calendar control.

from xamforms.controls.calendar.

rebeccaXam avatar rebeccaXam commented on July 2, 2024

Hallo, I do not understand how you added 5 months to the Calendar Control. To me it looks more like you added 5 Calendar controls after each other and you want one Date selected in all of these controls, am I correct?

When you used 5 Calendar Controls you could use:

public class CalendarVM : INotifyPropertyChanged
{
	public event PropertyChangedEventHandler PropertyChanged;
	private DateTime? _date;
	public DateTime? Date
	{
		get { return _date; }
		set
		{
			_date = value;
			PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Date));
		}
	}
}

And bind all the Calendar controls to the same BindingContext CalendarVM.

var vm = new CalendarVM();
calendar1.SetBinding(Calendar.SelectedDateProperty, nameof(vm.Date));
calendar1.BindingContext = vm;
calendar2.SetBinding(Calendar.SelectedDateProperty, nameof(vm.Date));
calendar2.BindingContext = vm;
etc...........

or in xaml

<controls:Calendar SelectedDate="{Binding Date}" />
<controls:Calendar SelectedDate="{Binding Date}" />
<controls:Calendar SelectedDate="{Binding Date}" />

Then the selected date in all controls will be the same.
Hoop this helps ;)

from xamforms.controls.calendar.

pradeeparutla avatar pradeeparutla commented on July 2, 2024

Thankyou for the fast response.

To answer your question: I have added 5 different calendar controls one after each other to display more than one month at a time and Is there any other way I can add more than one month and scroll through the months using vertical scroll, same as the built in calendar control for iOS?

I hope I am missing something here.

If I am using the 5 different calendar controls for displaying 5 different months, then is there any way that, If I select a date in February then the date should be highlighted with some color, then the previously selected month in january to be unselected and color should be as normal date?

from xamforms.controls.calendar.

pradeeparutla avatar pradeeparutla commented on July 2, 2024

Hi RebeccaXam,

Thankyou for the fast response and a great control.

If I am using the 5 different calendar controls for displaying 5 different months, then my issue is now resolved using the solution provided by you.

So we can close this question. I have one related question with my implementation. If you are okay please answer it here, or else I will create it as a separate question.

Is there any other way by using only one calendar control, I can add more than one month and scroll through the months using vertical scroll, same as the built in calendar control for iOS devices?

from xamforms.controls.calendar.

evandroabukamel avatar evandroabukamel commented on July 2, 2024

I have interest in this too. I tried to attach gestures to the calendar but no success.

from xamforms.controls.calendar.

rebeccaXam avatar rebeccaXam commented on July 2, 2024

To show multiple months to scroll through use ShowNumOfMonths = (1-12) in version 1.0.8
I added this as a feature in 1.0.8, please reopen this issue, if it is not fully fulfilled or open a new issue.

from xamforms.controls.calendar.

pradeeparutla avatar pradeeparutla commented on July 2, 2024

Thank you rebacca for the solution. 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 a particular date other than the current month. Example: if current date selected in calendar is Jan 15th 2017, on selecting a date Feb 3rd 2017, Date clicked event is triggered twice(Event is triggering 2 times).

from xamforms.controls.calendar.

VishVenu avatar VishVenu commented on July 2, 2024

Hi,
I want to display one month dates at a time. Kindly help.

Eg: Currently it is showing Jan 1 to 31 and Feb 1 to to 11. I want to display only Jan 1 to 31 at a time.

from xamforms.controls.calendar.

Related Issues (20)

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.