This is a migrated thread and some comments may be shown as answers.

TreeView Items loosing focus when clicking other controls

2 Answers 600 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ryan Black
Top achievements
Rank 1
Ryan Black asked on 17 Dec 2010, 04:00 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Petar Mladenov
Telerik team
answered on 22 Dec 2010, 02:09 PM
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
0
Ryan Black
Top achievements
Rank 1
answered on 22 Dec 2010, 02:55 PM
So simple!

Thanks, thats just what I was missing.

Ryan
Tags
TreeView
Asked by
Ryan Black
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Ryan Black
Top achievements
Rank 1
Share this question
or