Custom DropDown KeyPressed

2 posts, 0 answers
  1. Christie Admin
    Christie Admin avatar
    239 posts
    Member since:
    Aug 2013

    Posted 22 Sep 2014 Link to this post

    Hi,

    I created a custom UserControl based on the RadAutoCompleteBox control and I customized the dropdown using a style to have a grouping feature. In the dropdown, for each group, I use a RadExpander containing the group title and a button to expand or collapse the group. If the user use the up/down arrow keys to navigate through the item, when the user are on an expander, I would like to catch to catch the left/right arrow keys to expand/collapse the expander.

    How it's possible to do this???

    Thank's
    Alain

    Here is my style:

                <Style x:Key="SearchBoxControlItem" TargetType="telerik:RadListBoxItem" BasedOn="{StaticResource RadListBoxItemStyle}">
                    <Setter Property="FontWeight" Value="Medium" />
                    <Setter Property="FontFamily" Value="Segoe UI" />
                    <Setter Property="FontSize" Value="12" />
                    <Setter Property="IsEnabled" Value="True"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <WrapPanel Grid.Column="0" VerticalAlignment="Center" Orientation="Horizontal" Margin="5 0">
                                        <TextBlock Text="{Binding Name}" Foreground="Black" FontWeight="Normal" IsHitTestVisible="False" TextWrapping="Wrap" VerticalAlignment="Center"/>
                                        <TextBlock Text="{Binding TotalItems, StringFormat='({0})'}" Foreground="Black" FontWeight="Normal" IsHitTestVisible="False" Margin="5 0 0 0" VerticalAlignment="Center"/>                                    
                                    </WrapPanel>
                                    <Rectangle Grid.Column="1" Fill="LightGray" Height="1" Stroke="LightGray" VerticalAlignment="Center" Margin="2 0" />
                                    <telerik:RadExpander Style="{DynamicResource RadExpanderStyle}" Grid.Column="2" Margin="2 0" Loaded="RadExpander_Loaded" Collapsed="RadExpander_CollapsedExpanded" VerticalAlignment="Center" Expanded="RadExpander_CollapsedExpanded" IsTabStop="False" />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 24 Sep 2014 Link to this post

    Hi Alain,

    In the current version of RadAutoCompleteBox control grouping is not supported out of the box and implementing it could lead to unexpected and not supported behaviors. The previously described and provided sample projects were meant to be used as a reference for a simple implementation of the grouping feature. I took a look at the provided project in the thread with ID: 823626 and unfortunately achieving the desired custom navigation behavior is not an easy task and borders to be impossible in the current version of RadAutoCompleteBox. As there is not grouping support in the control in the project from that thread the RadExpander items are treated as simple items from the FilteredItems collection of the AutoCompleteBox. The control does not provide information for the current item which is highlighted and it is impossible to trigger a custom logic which would expand that item (if it is RadExpander).

    The described custom implementation of grouping with custom ItemTemplate that contains Expander control is out of the scope of the RadAutoCompleteBox and we cannot provide you with the best approach which could be used to create such a custom control.

    Regards,
    Vladi
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top