Exemplo n.º 1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool  val    = (bool)value;
            Color result = XamFormsColorHelper.DefaultColor;  //get default color

            if (!String.IsNullOrWhiteSpace(parameter?.ToString()))
            {
                string param =
                    parameter.ToString()
                    .Trim()
                    .Split(';')
                    .FirstOrDefault(
                        f =>
                        (f ?? "").Trim()
                        .StartsWith(val.ToString().ToLower() + ":"));
                if (!String.IsNullOrWhiteSpace(param))
                {
                    result = XamFormsColorHelper.GetCodeBrixColorByKey(param.Replace(val.ToString().ToLower() + ":", ""));
                }
            }

            return(result);
        }
Exemplo n.º 2
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     return((parameter is String colorKey && (!String.IsNullOrWhiteSpace(colorKey)))
         ? XamFormsColorHelper.GetCodeBrixColorByKey(colorKey)
         : XamFormsColorHelper.DefaultColor);
 }