New Posts New Posts RSS Feed: Changing the ErrorProvider Behavior for Loose Controls
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Changing the ErrorProvider Behavior for Loose Controls

 Post Reply Post Reply
Author
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 346
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post Topic: Changing the ErrorProvider Behavior for Loose Controls
    Posted: 06-Jun-2007 at 1:08pm

Answer:

The following snippet shows you how you can gain access to the ErrorProvider of a control to change its properties, or replace it entirely:

 

      // For some Control pControl, retrieve its data bindings

      foreach(Binding aBinding in pControl.DataBindings) {

        // Cast the binding to an IdeaBladeBinding

        IdeaBladeBinding binding = aBinding as IdeaBladeBinding;

       

        if (binding != null && binding.PropertyName == "SomeBindingPropertyName") {

          // e.g. Change blinking to never blink.

          ErrorProvider errorProvider = binding.ErrorProvider;

          errorProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink;

 

          // or

 

          // e.g. Replace ErrorProvider entirely

          binding.ErrorProvider = ModifiedErrorProvider;       

        }

      }

If, however, you are interested in modifying the default exception-handling behavior of a DevForce data binding, please consult the section in the Developer’s Guide titled “Modifying the Default Error Handling Behavior of the Binding.” This section describes a couple of ways to do this as well as an example of how you can replace the ControlBindingDescriptor’s Error event with your own handler.

Back to Top
Customer View Drop Down
Senior Member
Senior Member
Avatar
User Submitted Questions to Support

Joined: 30-May-2007
Location: United States
Posts: 260
Post Options Post Options   Quote Customer Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jun-2007 at 1:06pm

Question:

How can I change DevForce’s UI behavior in response to a data validation failure?  I don’t want the flashing exclamation point!

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down