IsEnabled not updating?

2 posts, 1 answers
  1. Kristoffer
    Kristoffer avatar
    158 posts
    Member since:
    Dec 2012

    Posted 10 Apr 2013 Link to this post

    I have a toolbar with a button that executes a command. When the command is executed, I set a property from code behind:
    SetValue(IsRunningProperty, true);

    A worker thread does some work, and when completed the property is updated again:
    SetValue(IsRunningProperty, false);

    The toolbar binds to this property as follows:
    <telerik:RadButton Margin="2" Command="{StaticResource Commands.Run}" IsEnabled="{Binding IsRunning, Converter={StaticResource InverseBooleanConverter}}">
      <Image Stretch="None" Source="..." />
    </telerik:RadButton>

    This works as long as the toolbar is not focused. If I press the button and wait for my worker to complete, the button will remain disabled until I click in my RadDiagram.

    Why isn't the toolbar updating immediately?

    UPDATE: Ok, it seems this is caused by a call to someOtherWindow.Focus(). Still, why doesn't the toolbar update itself?
  2. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 10 Apr 2013 Link to this post

    Hello Kristoffer,

    RadToolBar is designed to be a separate focus scope. You can try setting the attached property:

    FocusManager.IsFocusScope=False
    in XAML and check if all your scenarios work as expected.

    All the best,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top