public CalendrierPage() { //Definition du titre de la page Title = "Calendrier"; stackLayout = new StackLayout (); Content = stackLayout; //Definition du calendrier calendarView = new CalendarView { MinDate = CalendarView.FirstDayOfMonth(new DateTime(2014, 1, 1)), MaxDate = CalendarView.LastDayOfMonth(DateTime.Now.AddYears(2)), ShouldHighlightDaysOfWeekLabels = true, SelectionBackgroundStyle = CalendarView.BackgroundStyle.CircleFill, ShowNavigationArrows = true, HeightRequest= 800, WidthRequest= 800 }; //Ajout du calendrier dans la vue stackLayout.Children.Add(calendarView); //Evenement lorsque l'on clique sur une date calendarView.DateSelected += async (object sender, DateTime e) => { await Navigation.PushAsync(new AjoutEvenement(e.ToString())); }; //Ajoute des points si il y a des evenements a une date donnée }
/// <summary> /// Initializes a new instance of the <see cref="CalendarPage"/> class. /// </summary> public CalendarPage() { InitializeComponent(); _relativeLayout = new RelativeLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; Content = _relativeLayout; _calendarView = new CalendarView() { //BackgroundColor = Color.Blue MinDate = CalendarView.FirstDayOfMonth(DateTime.Now), MaxDate = CalendarView.LastDayOfMonth(DateTime.Now.AddMonths(3)), HighlightedDateBackgroundColor = Color.FromRgb(227 ,227, 227 ), ShouldHighlightDaysOfWeekLabels = false, SelectionBackgroundStyle = CalendarView.BackgroundStyle.CircleFill, TodayBackgroundStyle = CalendarView.BackgroundStyle.CircleOutline, HighlightedDaysOfWeek = new DayOfWeek[]{DayOfWeek.Saturday,DayOfWeek.Sunday}, ShowNavigationArrows = true, MonthTitleFont = Font.OfSize("Open 24 Display St",NamedSize.Medium) }; _relativeLayout.Children.Add(_calendarView, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent(p => p.Width), Constraint.RelativeToParent(p => p.Height * 2/3)); _stacker = new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.StartAndExpand }; _relativeLayout.Children.Add(_stacker, Constraint.Constant(0), Constraint.RelativeToParent(p => p.Height *2/3), Constraint.RelativeToParent(p => p.Width), Constraint.RelativeToParent(p => p.Height *1/3) ); _calendarView.DateSelected += (object sender, DateTime e) => { _stacker.Children.Add(new Label() { Text = "Date Was Selected" + e.ToString("d"), VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.CenterAndExpand, }); }; }
public ScheduleView() { if (Device.OS == TargetPlatform.Android) { var calendar = new CalendarView { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.CenterAndExpand }; var stack = new StackLayout { Spacing = 0 }; stack.Children.Add(calendar); Content = stack; } }
public CalendrierPage() { //Definition du titre de la page Title = "Calendrier"; relativeLayout = new RelativeLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; Content = relativeLayout; //Definition du calendrier calendarView = new CalendarView () { MinDate = CalendarView.FirstDayOfMonth(new DateTime(2016, 1, 1)), MaxDate = CalendarView.LastDayOfMonth(DateTime.Now.AddYears(2)), ShouldHighlightDaysOfWeekLabels = true, SelectionBackgroundStyle = CalendarView.BackgroundStyle.CircleFill, ShowNavigationArrows = true }; //Ajout du calendrier dans la vue relativeLayout.Children.Add(calendarView, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent(p => p.Width), Constraint.RelativeToParent(p => p.Height * 2/3)); stackLayout = new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.StartAndExpand }; relativeLayout.Children.Add(stackLayout, Constraint.Constant(0), Constraint.RelativeToParent(p => p.Height *2/3), Constraint.RelativeToParent(p => p.Width), Constraint.RelativeToParent(p => p.Height *1/3) ); //Evenement lorsque l'on clique sur une date calendarView.DateSelected += async (object sender, DateTime e) => { await Navigation.PushAsync(new AjoutEvenement(e.ToString())); }; //Ajoute des points si il y a des evenements a une date donnée }
public CalendarPage() { caldendarView = new CalendarView() { //BackgroundColor = Color.Blue, MinDate = CalendarView.FirstDayOfMonth(DateTime.Now.AddYears(-1)), MaxDate = CalendarView.LastDayOfMonth(DateTime.Now.AddYears(1)), HighlightedDateBackgroundColor = Color.FromRgb(227, 227, 227), ShouldHighlightDaysOfWeekLabels = false, SelectionBackgroundStyle = CalendarView.BackgroundStyle.CircleFill, TodayBackgroundStyle = CalendarView.BackgroundStyle.CircleOutline, HighlightedDaysOfWeek = new DayOfWeek[] { DayOfWeek.Saturday, DayOfWeek.Sunday }, ShowNavigationArrows = true, MonthTitleFont = Font.OfSize("Open 24 Display St", NamedSize.Medium), }; caldendarView.DateSelected += (object sender, DateTime e) => { Navigation.PushAsync(new ListCalendarPage(e)); }; }
void OnStartDateCalanderClicked(object sender, EventArgs e) { try { CalendarView calendarView = new CalendarView() { BackgroundColor = Color.FromRgb(30, 126, 210),// Color.FromRgb(200, 219, 238), MinDate = CalendarView.FirstDayOfMonth(DateTime.Now), MaxDate = CalendarView.LastDayOfMonth(DateTime.Now.AddMonths(3)), HighlightedDateBackgroundColor = Color.FromRgb(227, 227, 227), ShouldHighlightDaysOfWeekLabels = false, SelectionBackgroundStyle = CalendarView.BackgroundStyle.CircleFill, TodayBackgroundStyle = CalendarView.BackgroundStyle.CircleOutline, HighlightedDaysOfWeek = new DayOfWeek[] { DayOfWeek.Saturday, DayOfWeek.Sunday }, ShowNavigationArrows = true, MonthTitleFont = Font.OfSize("Open 24 Display St", NamedSize.Medium), MonthTitleForegroundColor = Color.White, DayOfWeekLabelForegroundColor = Color.White, }; calendarView.ClassId = "startcalander"; calendarView.DateSelected += OnStartDateCalendarViewDateSelected; masterLayout.AddChildToLayout(calendarView, 0, 35); } catch (Exception ex) { var test = ex.Message; } }
void startDatePickerButton_Clicked(object sender, EventArgs e) { CalendarView startCalendarView = new CalendarView() { MinDate = CalendarView.FirstDayOfMonth(DateTime.Now), MaxDate = CalendarView.LastDayOfMonth(DateTime.Now.AddMonths(3)), HighlightedDateBackgroundColor = Color.FromRgb(227, 227, 227), ShouldHighlightDaysOfWeekLabels = false, SelectionBackgroundStyle = CalendarView.BackgroundStyle.CircleFill, TodayBackgroundStyle = CalendarView.BackgroundStyle.CircleOutline, HighlightedDaysOfWeek = new DayOfWeek[] { DayOfWeek.Saturday, DayOfWeek.Sunday }, ShowNavigationArrows = true, MonthTitleFont = Font.OfSize("Open 24 Display St", NamedSize.Medium) }; startCalendarView.ClassId = "startcalendar"; startCalendarView.DateSelected += startCalendarView_DateSelected; masterLayout.AddChildToLayout(startCalendarView, 0,20); }