Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
XamMaskedEditor custom spin click logic
posted

XamDateTimeEditor does not support masks for years and months only. Also I need edit quarters. Because of that I have to use XamMaskedEditor but it has limitations with spin buttons. I cannot write custom logic to increment or decrement quarter value because

  1. If set SpinIncrement value to 3m then Quarter value become null cause it is string (2010 Q1) and control does not know how to increment or decrement value.
  2. If does not set SpinIncrement then commands MaskedEditorCommands.SpinUp and MaskedEditorCommands.SpinDown never happen/execute

How to make spin buttons work as I require?

 

Note: I subscribe to commands

<Style TargetType="{x:Type igEditors:XamNumericEditor}">

<EventSetter Handler="x_ExecutingCommand" Event="ExecutingCommand"/>

</Style>

...

 

void OnExecutingCommand(object sender, Infragistics.Windows.Controls.Events.ExecutingCommandEventArgs e)

        {

            if (e.Command == MaskedEditorCommands.SpinUp || e.Command == MaskedEditorCommands.SpinDown)

            {

                e.Cancel = true;

                ....

            }

        }

Parents
No Data
Reply
  • 14517
    Offline posted

    Hello,

    In order to catch the command in this scenario, you can add a style with an event setter to the Repeat Button and then get the underlying command in the click event of the repeat button

    <igEditors:XamMaskedEditor SpinButtonStyle="{StaticResource rbStyle}" ,,,


    <Style x:Key="rbStyle" TargetType="{x:Type RepeatButton}">
         <EventSetter Event="Click" Handler="rb_Click"/>
    </Style>

    void rb_Click(object sender, RoutedEventArgs e)
    {
       RepeatButton rb = (RepeatButton)sender;
       IGRoutedCommand cmd = (IGRoutedCommand)rb.Command;
       ...
    }


    Sincerely,
    Valerie
    Developer Support Engineer
    Infragistics
    www.infragistics.com/support

Children
No Data