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);
        }
Beispiel #2
0
        public List <WDetailSingleRowViewModel> CustomizeHeader(PropertyInfo property, string display_name, bool is_editable, object source)
        {
            WDetailSingleRowViewModel single_row = new WDetailSingleRowViewModel(display_name);

            SingleUpDown singleupdown = new SingleUpDown();

            singleupdown.IsEnabled = is_editable;

            Binding tbind = new Binding(property.Name)
            {
                Source = source,
                Mode   = BindingMode.TwoWay,
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
            };

            singleupdown.SetBinding(SingleUpDown.ValueProperty, tbind);

            single_row.PropertyControl = singleupdown;

            return(new List <WDetailSingleRowViewModel>()
            {
                single_row
            });
        }