-
Notifications
You must be signed in to change notification settings - Fork 20
Ribbon NumericUpDown not disabling. #141
Comments
And ... now.. for some reason, it's working. I have no idea why. I'm going to close this for now since it's working as it should. |
OK, so, for some inexplicable reason, the numerics are no longer staying disabled again on startup. Here's the weirdness of it all: This is quite schizophrenic. |
So, digging through KryptonRibbonGroupNumericUpDown.cs, I noticed that the Enabled property uses an internal private variable to store its state. This is fine, but the underlying control is not updated. It looks like it gets updated at runtime via the PropertyChanged event, but not on initialization. So basically, by setting Enabled = false in the designer, we end up with a control wrapper that is out of sync with it's underlying control. This would explain the really crazy behavior I saw (beyond that of not respecting the flag - weird flashing everytime the property was set, big performance hits, etc...) For giggles, I added this to the enabled property (after the _enabled assignment): That seems to have cleared up the issue. To fix this, I'd probably get rid of the internal private variable tracking the enabled state, and just use the Enabled property on the underlying control as a mirror. Same with any other property exposed. And any property that does not fit the context of the control wouldn't be exposed at all. Of course, my concern here is that if the state flag is removed and replaced with the underlying Enabled property, what will it break? Was it done this way for a specific purpose? |
I have 2 numeric up down controls on the ribbon, along with 2 labels.
On startup of my application, these labels and numerics should be disabled. But, only the labels are disabled.
If I change the Enabled state on the numeric by clicking the "Fixed Size" button, the numerics will disable just fine.
I've walked through the code with the debugger to ensure that the Enabled flag is being set to False at startup (this also happens if I set Enabled to False in the designer), and it is being set (and the property returns False as it should), yet they are still enabled.
All other control types that I have on the ribbon behave properly, so far, only the numeric is not behaving correctly.
The text was updated successfully, but these errors were encountered: