Exemplo n.º 1
0
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            IProvideTargetValue valueService = IServiceProviderHelper <IProvideTargetValue> .GetService(serviceProvider, typeof(ColorBlendExtension).ToString());

            styleParameterSerivce = IServiceProviderHelper <IPropertiesProvider> .GetService(serviceProvider, typeof(ColorBlendExtension).ToString());

            string[] extenderParameters = valueService.SourceValue.Split(',');

            if (extenderParameters.Length < 4)
            {
                throw new ArgumentException("parameters not valid!");
            }

            this.themePropertyName = extenderParameters[0].Trim();
            if (string.IsNullOrEmpty(ThemePropertyName))
            {
                throw new InvalidOperationException("The first argument of RelativeColor exptrssion should be the name of the ThemeProperty");
            }

            int.TryParse(extenderParameters[1].Trim(), out colorADiff);
            double.TryParse(extenderParameters[2].Trim(), out colorHDiff);
            double.TryParse(extenderParameters[3].Trim(), out colorSDiff);
            double.TryParse(extenderParameters[4].Trim(), out colorLDiff);

            return(this);
        }
Exemplo n.º 2
0
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            IProvideTargetValue service = IServiceProviderHelper <IProvideTargetValue> .GetService(serviceProvider, typeof(ParameterReferenceExtension).ToString());

            this.styleParameterSerivce = IServiceProviderHelper <IPropertiesProvider> .GetService(serviceProvider, typeof(ParameterReferenceExtension).ToString());

            this.themePropertyName = service.SourceValue.Trim();
            if (string.IsNullOrEmpty(this.themePropertyName))
            {
                throw new InvalidOperationException("The first argument of RelativeColor exptrssion should be the name of the ThemeProperty");
            }
            return((object)this);
        }