This question is locked. New answers and comments are not allowed.
On a previous thread, Hristo posted the following:
"We made some changes in IsEnabled property - when you set it to False then RadMenuItem will be disabled no matter what ICommand CanExecute return. But if IsEnabled is True then IsEnabled actual value will be based on ICommand CanExecute result. That is why probably we clear your binding. Please specify Binding Mode=TwoWay so that Binding will not be removed internally."
Since this change we seem to be experiencing some issues with toggling IsEnabled on an ICommand object.
We bind the menu control within a HierarchicalDataTemplate with the following container binding:
<telerik:ContainerBinding PropertyName="IsEnabled" Binding="{Binding AllowAccess}" />
I've also tried the following:
<telerik:ContainerBinding PropertyName="IsEnabled" Binding="{Binding AllowAccess, Mode=TwoWay}" />
The allow access property is read-only and is internally set to true or false when the page is created (in this example, I did verify it was always going to return true). The menu item has a command bound to it with CanExecute initially to false. As expected, the menu item is disabled as CanExecute is evaluated as soon as I hover on the menu. Once I've done something on the screen where the ICommand object should re-evaluate whether it can execute now, hovering on the menu once again does not seem to re-execute CanExecute of the command object so it is never re-evaluated as expected to true and re-enable the item. I did try to make the AllowAccess binding two way with no luck.
I also set it up so the initial value of CanExecute on the screen to true which left the menu item enabled as expected (again evaluated as soon as I hovered on the menu. Once I performed an action on the screen that would make the command re-evaluate CanExecute to false, the menu did not re-evaluate but the command did once I clicked on it (in other words the menu item should have been disabled and not allowed me to click on it). With CanExecute back to false, I once again changed the screen to be true yet the menu item never re-enabled.
Shouldn't the menu re-execute CanExecute on each ICommand object to check if it hasn't changed since the initial "IsEnabled" of the menu item was set to true?
"We made some changes in IsEnabled property - when you set it to False then RadMenuItem will be disabled no matter what ICommand CanExecute return. But if IsEnabled is True then IsEnabled actual value will be based on ICommand CanExecute result. That is why probably we clear your binding. Please specify Binding Mode=TwoWay so that Binding will not be removed internally."
Since this change we seem to be experiencing some issues with toggling IsEnabled on an ICommand object.
We bind the menu control within a HierarchicalDataTemplate with the following container binding:
<telerik:ContainerBinding PropertyName="IsEnabled" Binding="{Binding AllowAccess}" />
I've also tried the following:
<telerik:ContainerBinding PropertyName="IsEnabled" Binding="{Binding AllowAccess, Mode=TwoWay}" />
The allow access property is read-only and is internally set to true or false when the page is created (in this example, I did verify it was always going to return true). The menu item has a command bound to it with CanExecute initially to false. As expected, the menu item is disabled as CanExecute is evaluated as soon as I hover on the menu. Once I've done something on the screen where the ICommand object should re-evaluate whether it can execute now, hovering on the menu once again does not seem to re-execute CanExecute of the command object so it is never re-evaluated as expected to true and re-enable the item. I did try to make the AllowAccess binding two way with no luck.
I also set it up so the initial value of CanExecute on the screen to true which left the menu item enabled as expected (again evaluated as soon as I hovered on the menu. Once I performed an action on the screen that would make the command re-evaluate CanExecute to false, the menu did not re-evaluate but the command did once I clicked on it (in other words the menu item should have been disabled and not allowed me to click on it). With CanExecute back to false, I once again changed the screen to be true yet the menu item never re-enabled.
Shouldn't the menu re-execute CanExecute on each ICommand object to check if it hasn't changed since the initial "IsEnabled" of the menu item was set to true?