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
205
Binding the Enabled/Visible Property of the Controls
posted

Hi,

I have an application with several types of Controls (UltraCheckEditor, ButtonTools, etc), that I want to Enable or Disable them according the kind of License that the user bought.

I wonder if there is a way that Infragistics supports to create a kind of Injection or Proxy that can intercept the call to Enable or other Properties of the Control, and the desired logic can be added there.

If Infragistics does not support it, there are other recomendations?

Thanks

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    How would "intercepting the call to Enable" help? Are you saying you want to stop the control from being enabled when the permissions do not allow it?

    If that's what you want, you could derive a control from each of the controls and override the Enabled property. But that's probably more work than it's worth.

    Another option, which is kind've ugly, but might work, is to trap an event like EnabledChanged (assuming there is such an event) and then if the property gets set to an invalid value, set it back immediately.

    What I would do is find all the place in the code where the Enabled property was being set and replace those calls with a method call which checks the permissions before setting the property. It's not a great solution, because someone might, in the future, circumvent the method call and set the property directly. Maybe you could put an assert into the EnabledChanged event to handle that case.

Children
No Data