Giter VIP home page Giter VIP logo

gu.wpf.propertygrid's People

Contributors

erikwahlstrom avatar johanlarsson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gu.wpf.propertygrid's Issues

reset on error

    public class ValueControl : Control
    {
        public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(
            "Value",
            typeof(int),
            typeof(ValueControl),
            new FrameworkPropertyMetadata(
                default(int),
                FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
                null,
                CoerceValue));

        private bool isResetting;

        static ValueControl()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(ValueControl), new FrameworkPropertyMetadata(typeof(ValueControl)));
            EventManager.RegisterClassHandler(typeof(ValueControl), Validation.ErrorEvent, new EventHandler<ValidationErrorEventArgs>(OnError));
        }

        public int Value
        {
            get { return (int)this.GetValue(ValueProperty); }
            set { this.SetValue(ValueProperty, value); }
        }

        private static object CoerceValue(DependencyObject d, object basevalue)
        {
            var control = (ValueControl)d;
            if (control.isResetting)
            {
                return control.GetValue(ValueProperty);
            }

            return basevalue;
        }

        private static void OnError(object sender, ValidationErrorEventArgs e)
        {
            if (e.Action == ValidationErrorEventAction.Added)
            {
                var control = (ValueControl)sender;
                control.isResetting = true;
                BindingOperations.GetBindingExpressionBase(control, ValueProperty)?.UpdateTarget();
                control.isResetting = false;
            }
        }
    }

Allow spinners

  • Numeric boxes
  • Unit boxes
    • Increment unit and scalar + attached.

Respec styles in App.xaml

For example SelectorSettingControl does not use a style for Combobox in App.xaml

        <Style TargetType="{x:Type ComboBox}">
            <Setter Property="Foreground" Value="Green" />
        </Style>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.