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

RadTreeView Item Losing Focus

3 Answers 111 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ricky Wu
Top achievements
Rank 1
Ricky Wu asked on 13 Mar 2012, 09:54 PM
Is there an equivalent way for getting the ActionOnLostFocus property for RadTreeView (like there is for RadTreeListView). We have a RadTreeView which has a textbox as a template node. When the user clicks on a ribbon paste button, the textbox loses focus.
(In RadTreeListView by setting the property ActionOnLostFocus=None we can avoid this scenario.)
Is there a workaround or a hack for this purpose?

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 15 Mar 2012, 11:29 AM
Hello Ricky,

 The way to control whether a RadRibbonButton will / will not receive focus when clicked is to use itsIsTabStop property. Please check out the attached project where this is demonstrated. 

<telerik:RadRibbonView>  
    <telerik:RadRibbonTab Header="Header A">
        <telerik:RadRibbonGroup Header="Group" x:Name="group">
            <telerik:RadRibbonButton Content="Paste" IsTabStop="False"/>
        </telerik:RadRibbonGroup>
    </telerik:RadRibbonTab>
</telerik:RadRibbonView>
Regards,
Petar Mladenov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Ricky Wu
Top achievements
Rank 1
answered on 15 Mar 2012, 01:21 PM
 We are already setting the IsTabStop property as False. We are actually using a RadSplitButton and the focus is being lost when the actual split button is clicked. There are menu items inside the split button and clicking them does not result in focus being lost.
I modified the provided project to add the split button and focus is lost even when the IsTabStop is set to false when you click on the split button itself. The same works OK with a RadTreeListView with FocusLostAction set to None.
<telerik:RadRibbonView>  
           <telerik:RadRibbonTab Header="Header A">
               <telerik:RadRibbonGroup Header="Group" x:Name="group">
                   <telerik:RadRibbonButton Content="Paste" IsTabStop="False"/>
               </telerik:RadRibbonGroup>
               <telerik:RadRibbonGroup Header="Clipboard" x:Name="groupPaste">
                   <telerik:RadRibbonSplitButton Text="Paste"                                                 
                                                 Command="{Binding PasteCommand}"
                                                 Size="Large"
                                                 telerik:ScreenTip.Title="Paste"
                                                 telerik:ScreenTip.Description="Paste"
                                                 IsTabStop="False">
                       <telerik:RadRibbonSplitButton.DropDownContent>
                           <telerik:RadContextMenu BorderThickness="0"
                                                   IsTabStop="False">
                               <telerik:RadMenuItem Header="Paste"
                                                    IsTabStop="False"
                                                    Command="{Binding PasteCommand}"
                                                    telerik:ScreenTip.Title="Paste"
                                                    telerik:ScreenTip.Description="Paste">
                               </telerik:RadMenuItem>
 
 
                               <telerik:RadMenuItem Header="{Binding PasteSpecial}"
                                                    IsTabStop="False"
                                                    Command="{Binding PasteSpecialCommand}"
                                                    telerik:ScreenTip.Title="PasteSpecial"
                                                    telerik:ScreenTip.Description="PasteSpecial">
                               </telerik:RadMenuItem>
                           </telerik:RadContextMenu>
                       </telerik:RadRibbonSplitButton.DropDownContent>
                   </telerik:RadRibbonSplitButton>
               </telerik:RadRibbonGroup>
           </telerik:RadRibbonTab>           
       </telerik:RadRibbonView>
 <telerik:RadRibbonView>   
            <telerik:RadRibbonTab Header="Header A">
                <telerik:RadRibbonGroup Header="Group" x:Name="group">
                    <telerik:RadRibbonButton Content="Paste" IsTabStop="False"/>
                </telerik:RadRibbonGroup>
                <telerik:RadRibbonGroup Header="Clipboard" x:Name="groupPaste">
                    <telerik:RadRibbonSplitButton Text="Paste"                                                  
                                                  Command="{Binding PasteCommand}"
                                                  Size="Large"
                                                  telerik:ScreenTip.Title="Paste"
                                                  telerik:ScreenTip.Description="Paste"
                                                  IsTabStop="False">
                        <telerik:RadRibbonSplitButton.DropDownContent>
                            <telerik:RadContextMenu BorderThickness="0"
                                                    IsTabStop="False">
                                <telerik:RadMenuItem Header="Paste"
                                                     IsTabStop="False"
                                                     Command="{Binding PasteCommand}"
                                                     telerik:ScreenTip.Title="Paste"
                                                     telerik:ScreenTip.Description="Paste">
                                </telerik:RadMenuItem>




                                <telerik:RadMenuItem Header="{Binding PasteSpecial}"
                                                     IsTabStop="False"
                                                     Command="{Binding PasteSpecialCommand}"
                                                     telerik:ScreenTip.Title="PasteSpecial"
                                                     telerik:ScreenTip.Description="PasteSpecial">
                                </telerik:RadMenuItem>
                            </telerik:RadContextMenu>
                        </telerik:RadRibbonSplitButton.DropDownContent>
                    </telerik:RadRibbonSplitButton>
                </telerik:RadRibbonGroup>
            </telerik:RadRibbonTab>            
        </telerik:RadRibbonView>
0
Petar Mladenov
Telerik team
answered on 20 Mar 2012, 08:36 AM
Hi Ricky Wu,

 Our RadSplitButton is actually consisted of two buttons - RadButton and RadToggleButton. So you need set IsTabStop on both of them:

<telerik:RadButton x:Name="ButtonPart"
                                                 Grid.Row="0"
                                                 Grid.Column="0"
                                                 Grid.ColumnSpan="2"
                                                 Background="Transparent"
                                                 BorderThickness="0"
                                                 IsTabStop="False"
                                                 Content="{TemplateBinding Content}"
                                                 ContentTemplate="{TemplateBinding ContentTemplate}"
                                                 HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                 Padding="{TemplateBinding Padding}"
                                                 Template="{StaticResource RadSplitButton_ButtonStyle}"
                                                 VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
                              <telerik:RadToggleButton x:Name="DropDownPart"
                                                       Grid.Row="1"
                                                       Grid.Column="0"
                                                       Grid.ColumnSpan="2"
                                                       MinWidth="11"
                                                       MinHeight="7"
                                                       Margin="0"
                                                       HorizontalAlignment="Stretch"
                                                       Background="Transparent"
                                                       BorderThickness="0"
                                                       IsChecked="{TemplateBinding IsOpen}"
                                                       IsTabStop="false"
                                                       Template="{StaticResource RadSplitButton_DropDownStyle}"
                                                       Visibility="{TemplateBinding DropDownIndicatorVisibility}" />
Or you can bind these to the IstabStop of their parent : IsTabStop={TemplateBinding IsTabStop}.
You can see this realized in the attached project. Regards,
Petar Mladenov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
TreeView
Asked by
Ricky Wu
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Ricky Wu
Top achievements
Rank 1
Share this question
or