Esempio n. 1
0
 private void DateCliekd_Tapped(object sender, EventArgs e)
 {
     (sender as DateView).BackgroundColor = Color.FromHex("#2627549c");
     if (lastSaleted == null)
     {
         lastSaleted = (sender as DateView);
     }
     else if (lastSaleted != (sender as DateView))
     {
         lastSaleted.BackgroundColor = Color.Transparent;
         lastSaleted = (sender as DateView);
     }
 }
Esempio n. 2
0
        void initDatesGrid()
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                var columDef = new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                };
                var rowDef = new RowDefinition {
                    Height = new GridLength(45)
                };

                DatesGrid.ColumnDefinitions = new ColumnDefinitionCollection {
                    columDef, columDef, columDef, columDef, columDef, columDef, columDef
                };
                DatesGrid.RowDefinitions = new RowDefinitionCollection {
                    rowDef, rowDef, rowDef, rowDef, rowDef, rowDef, rowDef
                };
                DatesGrid.RowSpacing = 2;

                DatesGrid.Children.Add(new Label()
                {
                    Text = "Su", TextColor = Color.Red, FontSize = 15, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center
                }, 0, 0);
                DatesGrid.Children.Add(new Label()
                {
                    Text = "Mo", TextColor = Color.Black, FontSize = 15, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center
                }, 1, 0);
                DatesGrid.Children.Add(new Label()
                {
                    Text = "Tu", TextColor = Color.Black, FontSize = 15, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center
                }, 2, 0);
                DatesGrid.Children.Add(new Label()
                {
                    Text = "We", TextColor = Color.Black, FontSize = 15, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center
                }, 3, 0);
                DatesGrid.Children.Add(new Label()
                {
                    Text = "Th", TextColor = Color.Black, FontSize = 15, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center
                }, 4, 0);
                DatesGrid.Children.Add(new Label()
                {
                    Text = "Fr", TextColor = Color.Black, FontSize = 15, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center
                }, 5, 0);
                DatesGrid.Children.Add(new Label()
                {
                    Text = "Sa", TextColor = Color.Black, FontSize = 15, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center
                }, 6, 0);

                tapGestureRecognizer.Tapped += DateCliekd_Tapped;
                for (int r = 1; r < 7; r++)
                {
                    for (int c = 0; c < 7; c++)
                    {
                        var dateView = new DateView
                        {
                            //BorderColor = Color.FromHex("#f0f0f0"),
                            //BackgroundColor = Color.White,
                            //HeightRequest= 45,
                            //WidthRequest= 45,
                        };
                        dateView.GestureRecognizers.Add(tapGestureRecognizer);
                        //bnt.Clicked += DateClickedEvent;
                        DatesGrid.Children.Add(dateView, c, r);
                        dates.Add(dateView);
                    }
                }
            });
        }