This is a bit of a strange problem. (.NET 3.5sp1)
I have a UserControl containing three ToggleButtons, each with IsChecked bound to different dependency properties of UserControl itself. Two of these defaults to true and false to default.
When the application starts, UserControl itself (and therefore its contents) is disabled. When it is turned on later, all three buttons are displayed without clicking; however, the code properties are still in the correct state.
If the buttons are pressed, the properties will switch correctly, and the user interface (only for this button) will be updated to display the correct state (that is, clicking on a button that is displayed without pressing but has a true binding value, there will be no visible change for the first time, but updates the binding value to false). Pressing the “glitched” button a second time will behave normally (if it switches, the button will be pressed as expected).
If UserControl is not disabled at startup, the buttons will be displayed correctly (according to the state of the properties).
Unfortunately, UserControl must be disabled at startup, so I cannot start it with it enabled; I hope for an alternative solution. Any ideas?
(I tried to make the default properties false, and then set them to true on the user element Load. It does not matter.)
Miral source
share