protected override async void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            try
            {
                base.OnElementPropertyChanged(sender, e);

                element = (Card)Element;

                var editText = Control;
                if (element.Image != null)
                {
                    switch (element.ImageAlignment)
                    {
                    case ImageAlignment.Left:
                        editText.SetCompoundDrawablesWithIntrinsicBounds(await GetDrawable(element.Image), null, null, null);
                        break;

                    case ImageAlignment.Right:
                        editText.SetCompoundDrawablesWithIntrinsicBounds(null, null, await GetDrawable(element.Image), null);
                        break;
                    }
                }
                editText.CompoundDrawablePadding = 25;
                Control.Background.SetColorFilter(element.LineColor.ToAndroid(), PorterDuff.Mode.SrcAtop);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: " + ex.Message);
            }
        }
Esempio n. 2
0
        private async void SetIcon(Card view)
        {
            if (view.Image != null)
            {
                var ib = new ImageBrush
                {
                    ImageSource = await ImageHelper.GetImageFromImageSourceAsync(view.Image),
                    Stretch     = Stretch.None,
                    AlignmentX  = AlignmentX.Left
                };
                Control.Background = ib;

                var style = Windows.UI.Xaml.Application.Current.Resources["IconTextBoxStyle"];
                if (style != null)
                {
                    Control.Style = (Windows.UI.Xaml.Style)style;
                }
            }
        }