RadTreeView Item Losing Focus

4 posts, 0 answers
  1. Ricky Wu
    Ricky Wu avatar
    16 posts
    Member since:
    Apr 2010

    Posted 13 Mar 2012 Link to this post

    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?
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 15 Mar 2012 Link to this post

    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 >>
  3. DevCraft banner
  4. Ricky Wu
    Ricky Wu avatar
    16 posts
    Member since:
    Apr 2010

    Posted 15 Mar 2012 Link to this post

     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>
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 20 Mar 2012 Link to this post

    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 >>
Back to Top