Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Elegant Ribbon Tech Support » Ribbon and validating event Collapse All
Subject Author Date
Zaharia Octavian Oct 20, 2009 - 2:17 AM

Hi there!


Does any body knows way the validating event does not fire when a button in the ribbon is pressed? I have a user control on my form for editing the properties of an entity. I change something and when the validating event is fired I perform the same operation for that entity. Now if I change something in that editing form and press a button on the ribbon the validating event is not fired. Does any body knows a solution for this?


Best regards,


dexter

Technical Support Oct 22, 2009 - 7:23 AM

Actually there are certain conditions that should meet for Validating event to be raised. You can learn this from here:

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.validating.aspx

The main condition is that the validate control is loosing its focus. The ribbon control is more like menu and it doesn’t take the focus from the focused control in the most cases, it means that Validating event also will not fire.

We can suggest you a workaround for this:

1) Subscribe the Ribbon.PreviewMouseDown event.

2) Insert the following code into the event handler method:

private void ribbon1_PreviewMouseDown( object sender, Elegant.Ui.PreviewMouseEventArgs e )
{
    if ( e.Target != null && e.Target.GetType() == typeof( Elegant.Ui.Button ) )
    {
        Validate();
    }
}

This should solve your problem. If you still experience any problems please let us know.