Search code examples
c#wpfxamlxceed

DoubleUpDown increment by one with Page Up and Down


I would like to extend a DoubleUpDown from the Xceed - Toolkits, so that it works with PageUp and PageDown keys. The usual increment behaviour should be incrementing by 0.1, but if I use the PgUP or PgDn Keys the number should be incremented by 1.

Any ideas?

Thanks Steve


Solution

  • You could use an KeyBinding for this.

    Assuming value of the DoubleUpDown is stored in the Value property because I don't have the xceed toolkit.

    <xctk:DoubleUpDown Value="{Binding MyValue}">
        <xctk:DoubleUpDown.InputBindings>
            <KeyBinding Key="PageUp"
                        Command="{Binding IncrementCommand}"/>
        </xctk:DoubleUpDown.InputBindings>
    </xctk:DoubleUpDown>
    

    In your viewmodel you bind the value to MyValue and in the IncrementCommand you increment this value.