Example #1
0
        private Image CreateBackwardImage()
        {
            var BackwardImage = new Image()
            {
                Source            = ImageSource.FromResource("ShamsiDatePicker.Resources.Images.left.png"),
                Aspect            = Aspect.AspectFill,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                WidthRequest      = 15,
                HeightRequest     = 15
            };

            BackwardImage.SetValue(Grid.ColumnProperty, 3);

            var TintEffect = new TintImageEffect();

            TintEffect.Bindable.SetBinding(TintImageEffect.TintColorProperty, new Binding()
            {
                Source = DataContext,
                Path   = "CalendarTitleColor",
            });

            BackwardImage.Effects.Add(TintEffect);

            return(BackwardImage);
        }
Example #2
0
        public void SetColors()
        {
            BackgroundColor = Storage.BackColor;

            if (label.Text == "Выйти")
            {
                label.TextColor = Storage.SpecialRedColor;
                TintImageEffect effect = new TintImageEffect {
                    TintColor = Storage.SpecialRedColor
                };

                image.Effects.Clear();
                image.Effects.Add(effect);
            }
            else
            {
                label.TextColor = Storage.TextColor;

                TintImageEffect effect = new TintImageEffect {
                    TintColor = Storage.TextColor
                };

                image.Effects.Clear();
                image.Effects.Add(effect);
            }
        }
Example #3
0
        private Effect CreateTintImageEffect(bool value)
        {
            TintImageEffect tie = new TintImageEffect();
            int             k1  = (int)Math.Round(1.5 * LightBulbIntensity) + 105;
            int             k2  = (int)Math.Round(0.9 * LightBulbIntensity) + 165;

            tie.TintColor = value ? (Device.RuntimePlatform == Device.Android ? Color.FromRgb(k1, k1, k1) : Color.FromRgb(k2, k2, 0)) : Color.Transparent;
            return(tie);
        }
Example #4
0
        public void SetColors()
        {
            BackgroundColor = Storage.BackColor;

            SearchEntry.PlaceholderColor = Color.LightGray;
            SearchEntry.TextColor        = Storage.TextColor;

            TintImageEffect effect = new TintImageEffect {
                TintColor = Storage.TextColor
            };

            SearchImage.Effects.Clear();
            SearchImage.Effects.Add(effect);

            effect = new TintImageEffect {
                TintColor = Storage.TextColor
            };
            ClearImage.Effects.Clear();
            ClearImage.Effects.Add(effect);
            NotifLabel.TextColor = Storage.TextColor;
        }
Example #5
0
        public MenuFrameModel(string imageSource, string text, int size)
        {
            AppearenceSettings.CheckAndSetColors += SetColors;

            HasShadow    = false;
            CornerRadius = 0;

            TintImageEffect effect = new TintImageEffect {
                TintColor = Storage.TextColor
            };

            image = new ImageRenderer();
            if (!string.IsNullOrEmpty(imageSource))
            {
                image.Source        = "Resources/" + imageSource;
                image.HeightRequest = image.WidthRequest = 20;
                image.Aspect        = Aspect.AspectFit;
                image.Effects.Add(effect);
                image.VerticalOptions   = LayoutOptions.Center;
                image.HorizontalOptions = LayoutOptions.Start;
            }

            label = new Label
            {
                Text = text
            };

            label.Margin = new Thickness(5, 0, 0, 0);

            switch (size)
            {
            case 0:
                label.FontSize = Device.GetNamedSize(
                    NamedSize.Small, typeof(Label));
                break;

            case 1:
                label.FontSize = Device.GetNamedSize(
                    NamedSize.Default, typeof(Label));
                break;

            case 2:
            {
                label.FontSize = Device.GetNamedSize(
                    NamedSize.Medium, typeof(Label));
                label.FontAttributes = FontAttributes.Bold;
                label.Margin         = 0;
            }
            break;

            case 3:
            {
                label.FontSize = Device.GetNamedSize(
                    NamedSize.Large, typeof(Label));
                label.FontAttributes = FontAttributes.Bold;
                label.Margin         = 0;
            }
            break;
            }

            label.HorizontalTextAlignment             = label.VerticalTextAlignment
                                                      = TextAlignment.Center;
            label.VerticalOptions = LayoutOptions.FillAndExpand;
            if (!string.IsNullOrEmpty(imageSource))
            {
                label.HorizontalOptions = LayoutOptions.StartAndExpand;
            }
            else
            {
                label.HorizontalOptions = LayoutOptions.FillAndExpand;
            }


            StackLayout layout = new StackLayout()
            {
                Children = { image, label }
            };

            layout.Orientation                   = StackOrientation.Horizontal;
            layout.HorizontalOptions             = layout.VerticalOptions
                                                 = LayoutOptions.FillAndExpand;
            layout.Padding = 0;

            Content = layout;

            SetColors();
        }