public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var service = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;

            if (service == null)
            {
                return(null);
            }

            if (!(service.TargetObject is DependencyObject))
            {
                return(null);
            }

            var property = new ReferenceProperty((DependencyObject)service.TargetObject, (DependencyProperty)service.TargetProperty);

            var parameters = this.GetParameters( );

            var localizedText = Translator.Translate(this.Key);

            if (parameters.Count == 0)
            {
                return(localizedText);
            }

            var localizedValue = new LocalizedValue(property, localizedText, parameters);

            return(localizedValue.GetValue( ));
        }
Example #2
0
 public LocalizedValue(ReferenceProperty property, string format, IEnumerable <Binding> parameters)
 {
     this.Property   = property;
     this.Parameters = parameters;
     this.Format     = format;
 }