TreeView Items loosing focus when clicking other controls

3 posts, 1 answers
  1. Ryan Black
    Ryan Black avatar
    54 posts
    Member since:
    Mar 2010

    Posted 17 Dec 2010 Link to this post

    I am having a hard time having my FileExplorer Treeview maintain item selection when I click on another control.  You can see this happening by clicking 'Open FileExplorer Window' and then clicking on the textbox below the Treeview.

    Im going to reference the same control that I have been using for various examples with you guys.
    Please download it here  Copy the foo directory to C:\

    Thanks again for your continued support!

    Ryan
  2. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 22 Dec 2010 Link to this post

    Hello Ryan Black,

    When you click on the TextBox on the bottom, your selection doesn`t fade away. The selected tree items are still selected but they are unfocused. The problem was that in every Multitrigger that uses the SelectionUnfocusedVisdual Border and the SelectionVisual Border, you have set the Opacity of the Border to 0 which makes it Invisible. I changed the opacity to 50 like so:
    <MultiTrigger>
                  <MultiTrigger.Conditions>
                      <Condition Property="IsSelected"
                                 Value="True" />
                      <Condition Property="IsSelectionActive"
                                 Value="False" />
                  </MultiTrigger.Conditions>
                  <Setter Property="Opacity"
                          TargetName="SelectionVisual"
                          Value="50" />
                  <Setter Property="Visibility"
                          TargetName="SelectionUnfocusedVisual"
                          Value="Visible" />
              </MultiTrigger>
    You can play with these multitriggers if you want different colors in the following situations:
    1) selected but not focused
    2) selected and focused.
    In the attached solution the two scenarios share common color. Please examine it and let me know if it works for you.

    Kind regards,
    Petar Mladenov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for WPF
  3. UI for WPF is Visual Studio 2017 Ready
  4. Ryan Black
    Ryan Black avatar
    54 posts
    Member since:
    Mar 2010

    Posted 22 Dec 2010 Link to this post

    So simple!

    Thanks, thats just what I was missing.

    Ryan
Back to Top