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

Custom DropDown KeyPressed

1 Answer 64 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Christie Admin
Top achievements
Rank 1
Christie Admin asked on 22 Sep 2014, 05:57 PM
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>

1 Answer, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 24 Sep 2014, 12:47 PM
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.
 
Tags
AutoCompleteBox
Asked by
Christie Admin
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Share this question
or