public bool CanProvideConverter(BinderViewBase view, BinderHint hint)
 {
     return hint == BinderHint.Money || hint == BinderHint.Weight ||
         hint == BinderHint.Length || hint == BinderHint.NaturalNumber ||
         hint == BinderHint.Year || hint == BinderHint.Percentage ||
         hint == BinderHint.MinutesDuration || hint == BinderHint.HoursAndMinutesDuration ||
         hint == BinderHint.MoneyString;
 }
        public ViewConverterBase ProvideConverter(BinderViewBase view, BinderHint hint)
        {
            if (hint == BinderHint.Money)
                return new ConvertConverter(typeof(decimal));

            if (hint == BinderHint.Weight || hint == BinderHint.Length ||
                hint == BinderHint.Percentage || hint == BinderHint.MinutesDuration ||
                hint == BinderHint.HoursAndMinutesDuration)
                return new ConvertConverter(typeof(double));

            if (hint == BinderHint.NaturalNumber || hint == BinderHint.Year)
                return new ConvertConverter(typeof(int));

            if (hint == BinderHint.MoneyString)
                return new FormatConverter("${0:0.00}");

            throw new InvalidOperationException();
        }
Example #3
0
 public void AddBinding(BinderViewBase view, ViewConverterBase converter)
 {
     _binder.AddBinding("Output", view, converter);
 }
Example #4
0
 public void AddBinding(BinderViewBase view)
 {
     _binder.AddBinding("Output", view);
 }