private FrameworkElement GenerateDecimalUpDown(PropertyInfo property, Binding binding)
        {
#if !SILVERLIGHT
            DecimalUpDown decimalUpDown = new DecimalUpDown()
            {
                Margin = new Thickness(0, 3, 18, 3)
            };
            decimalUpDown.IsReadOnly = !(bindables[property.Name].Direction == BindingDirection.TwoWay);

            // Binding
            this.bindings.Add(property.Name, decimalUpDown.SetBinding(DecimalUpDown.ValueProperty, binding));
#else
            Border decimalUpDown = new Border()
            {
                Opacity = 1.0, Background = new SolidColorBrush(Colors.White), Margin = new Thickness(0, 3, 18, 3)
            };
            NumericUpDown n = new NumericUpDown()
            {
            };
            decimalUpDown.Child = n;
            n.IsEnabled         = (bindables[property.Name].Direction == BindingDirection.TwoWay);

            n.Maximum = Convert.ToDouble(Decimal.MaxValue);
            n.Minimum = Convert.ToDouble(Decimal.MinValue);


            // Binding
            this.bindings.Add(property.Name, n.SetBinding(NumericUpDown.ValueProperty, binding));
#endif
            return(decimalUpDown);
        }
        private FrameworkElement GenerateSingleUpDown(PropertyInfo property, Binding binding)
        {
#if !SILVERLIGHT
            SingleUpDown calculatorUpDown = new SingleUpDown()
            {
                Margin = new Thickness(0, 3, 18, 3)
            };
            calculatorUpDown.IsReadOnly = !(bindables[property.Name].Direction == BindingDirection.TwoWay);
            // Binding
            this.bindings.Add(property.Name, calculatorUpDown.SetBinding(SingleUpDown.ValueProperty, binding));
#else
            Border calculatorUpDown = new Border()
            {
                Opacity = 1.0, Background = new SolidColorBrush(Colors.White), Margin = new Thickness(0, 3, 18, 3)
            };
            NumericUpDown n = new NumericUpDown()
            {
            };
            calculatorUpDown.Child = n;
            n.IsEnabled            = (bindables[property.Name].Direction == BindingDirection.TwoWay);

            // Binding
            this.bindings.Add(property.Name, n.SetBinding(NumericUpDown.ValueProperty, binding));
#endif
            return(calculatorUpDown);
        }
        private FrameworkElement GenerateIntegerUpDow(PropertyInfo property, Binding binding)
        {
#if !SILVERLIGHT
            IntegerUpDown integerUpDown = new IntegerUpDown()
            {
                Margin = new Thickness(0, 3, 18, 3)
            };
            integerUpDown.IsReadOnly = !(bindables[property.Name].Direction == BindingDirection.TwoWay);

            if (property.PropertyType == typeof(Int32) || property.PropertyType == typeof(Int32?))
            {
                integerUpDown.Maximum = Int32.MaxValue;
                integerUpDown.Minimum = Int32.MinValue;
            }
            else if (property.PropertyType == typeof(UInt32) || property.PropertyType == typeof(UInt32?))
            {
                integerUpDown.Maximum = Int32.MaxValue;
                integerUpDown.Minimum = 0;
            }

            // Binding
            this.bindings.Add(property.Name, integerUpDown.SetBinding(IntegerUpDown.ValueProperty, binding));
#else
            Border integerUpDown = new Border()
            {
                Opacity = 1.0, Background = new SolidColorBrush(Colors.White), Margin = new Thickness(0, 3, 18, 3)
            };
            NumericUpDown n = new NumericUpDown()
            {
            };
            integerUpDown.Child = n;
            n.IsEnabled         = (bindables[property.Name].Direction == BindingDirection.TwoWay);

            if (property.PropertyType == typeof(Int32) || property.PropertyType == typeof(Int32?))
            {
                n.Maximum = Int32.MaxValue;
                n.Minimum = Int32.MinValue;
            }
            else if (property.PropertyType == typeof(UInt32) || property.PropertyType == typeof(UInt32?))
            {
                n.Maximum = UInt32.MaxValue;
                n.Minimum = UInt32.MinValue;
            }


            // Binding
            this.bindings.Add(property.Name, n.SetBinding(NumericUpDown.ValueProperty, binding));
#endif
            return(integerUpDown);
        }