RadRibbonDropDown

3 posts, 0 answers
  1. Anthony
    Anthony avatar
    4 posts
    Member since:
    Nov 2015

    Posted 14 Jan Link to this post

    Is there a way to make the KeyTipService work for the items in a listbox on a RadRibbonDropDownButton?
  2. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 19 Jan Link to this post

    Hello Anthony,

    I will contact you tomorrow with more information on the matter.

    Regards,
    Martin
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 21 Jan Link to this post

    Hello Anthony,

    You can use the KeyTipService navigation with a ListBox control. If you set the KeyTipService.AcessText property on a ListBoxItem (or the ListBox itself), the service will be able to navigate to the control, but its internal logic won't know what action to execute. However, you can subscribe the ListBox to the KeyTipService's Activation event and implement the behavior which should be executed when the specific key is pressed.

    Here is an example in code:
    <telerik:RadRibbonView telerik:KeyTipService.IsKeyTipsEnabled="True">
        <telerik:RadRibbonTab Header="Home" telerik:KeyTipService.AccessText="A">
            <telerik:RadRibbonGroup>
                <telerik:RadRibbonDropDownButton Text="ListBoxButton" telerik:KeyTipService.AccessText="S">
                    <telerik:RadRibbonDropDownButton.DropDownContent>
                        <ListBox>
                            <ListBoxItem Content="Item 1" telerik:KeyTipService.AccessText="D">
                                <telerik:KeyTipService.Activation>
                                    <telerik:KeyTipActivation Activated="KeyTipActivation_Activated" />
                                </telerik:KeyTipService.Activation>
                            </ListBoxItem>
                            <ListBoxItem Content="Item 2" />
                            <ListBoxItem Content="Item 3" />
                        </ListBox>
                    </telerik:RadRibbonDropDownButton.DropDownContent>
                </telerik:RadRibbonDropDownButton>
            </telerik:RadRibbonGroup>
        </telerik:RadRibbonTab>
    </telerik:RadRibbonView>

    private void KeyTipActivation_Activated(object sender, Telerik.Windows.RadRoutedEventArgs e)
    {
        var listBoxItem = (ListBoxItem)e.OriginalSource;
        listBoxItem.IsSelected = true;
    }

    I hope this information helps.

    Regards,
    Martin
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top