Skip to content

Is there any way to use it without using a ViewModel? #151

Closed Answered by ME-MarvinE
OpenPachinko asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, do the same as you would using any other control. You can use x:Name on the CalendarView in the XAML and then change any of its properties from the code behind.

But if you're still okay with using bindings (And don't want to redo parts of copy-pasted code from the sample app like DataTriggers), using the Getting Started repo as an example:

  1. Move public Calendar<CalendarDay> MyCalendar { get; set; } = new Calendar<CalendarDay>(); from the ViewModel to the code behind for the page.
  2. Replace BindingContext = new MainPageViewModel() with BindingContext = this in the code behind of the page.

After that you should be able to use bindings as normal.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ME-MarvinE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants