Exemplo n.º 1
0
        private object FormatValue(object value, IPropertyMetadata propertyMetadata, CultureInfo cultureInfo)
        {
            // check if VM propery can be formatted. If not, pass through
            if (propertyMetadata != null && propertyMetadata.FormattableProperty)
            {
                if (string.CompareOrdinal(propertyMetadata.PropertyFormattingKey, "PriceFormat") == 0)
                {
                    var scopeCurrency = CurrencyProvider.GetCurrency();
                    if (!string.IsNullOrEmpty(scopeCurrency))
                    {
                        cultureInfo = _localizationProvider.GetCultureByCurrencyIso(scopeCurrency);
                    }
                }

                // format value
                return(_viewModelPropertyFormatter.Format(value, propertyMetadata, cultureInfo));
            }
            return(value);
        }