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

Issue with enabling dropdown on Focus.

0 Answers 192 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Avani
Top achievements
Rank 1
Avani asked on 22 May 2013, 10:57 AM
Hi,

I do have radautocompletebox with the dropdown button.

On clicking the button and on focus of the radautocomplete box, the dropdown is supposed to open.
The issue is when I select an item from the dropdown opened by button click and select an item from it, the selected item automatically sets to the text box inside the radautocompletebox thereby focusing on the same and the onFocus method gets called which is opening dropdown again which is not required.
This process happens so rapidly that two values (one from each dropdown) gets selected on a single click.
Kindly let me know in case if I am going wrong somewhere.

Below is the xaml code:
<ScrollViewer VerticalAlignment="Top" HorizontalScrollBarVisibility="Disabled" Grid.Column="0" VerticalScrollBarVisibility="Auto" Height="40" Width="186"  >
                        <telerik:RadAutoCompleteBox WatermarkContent="{Binding Path=WatermarkContent}"  HorizontalAlignment="Left" Name="radDeseaseCategoryAutoCompleteBox" Width="186"
                                    SelectionMode="Multiple"
                                    FilteringBehavior="{StaticResource EmptyTextFilteringBehavior}"
            TextSearchMode="Contains"
            TextSearchPath="Name" MinHeight="35"
                                     AutoCompleteMode="Suggest"
                                     ItemsSource="{Binding Path=DiseaseCategoryCollection, Source={StaticResource reportDropdownInfo}}"
                                     SelectedItems="{Binding Path=SelectedDiseaseCategoryCollection, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                                     GotFocus="DeseaseCompleteBoxGotFocus" LostFocus="DeseaseCompleteBoxLostFocus"
                                    >
                            <telerik:RadAutoCompleteBox.DropDownItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Name}" Width="190"/>
                                </DataTemplate>
                            </telerik:RadAutoCompleteBox.DropDownItemTemplate>
                            <telerik:RadAutoCompleteBox.BoxesItemTemplate>
                                <DataTemplate>
                                    <TextBox Text="{Binding Name}" IsEnabled="False" TextWrapping="Wrap" Width="140" MaxWidth="140"  Background="White" />
                                </DataTemplate>
                            </telerik:RadAutoCompleteBox.BoxesItemTemplate>
                        </telerik:RadAutoCompleteBox>
                    </ScrollViewer>
                    <telerik:RadButton Grid.Column="1" IsTabStop="False"
                               Click="DeseaseRadButtonClick"
                               VerticalAlignment="Top" HorizontalAlignment="Right"
                               Width="15"
                               Height="40" Grid.Row="1">
                        <Path Data="M0,0 L4,0 L4,4 z" Fill="Black" HorizontalAlignment="Right" Height="5" Stretch="Fill" VerticalAlignment="Center" Width="5" UseLayoutRounding="False" RenderTransformOrigin="0.5,0.5">
                            <Path.RenderTransform>
                                <RotateTransform Angle="135" />
                            </Path.RenderTransform>
                        </Path>
                    </telerik:RadButton>

Here is the method in code behind. .

 private void MechOfActRadButtonClick(object sender, RoutedEventArgs e)
        {
            radMecofActionAutoCompleteBox.Focus();
        }

        private void RadMecofActionAutoCompleteBoxGotFocus(object sender, RoutedEventArgs e)
        {
            radMecofActionAutoCompleteBox.WatermarkContent = "";
            radMecofActionAutoCompleteBox.Populate(radMecofActionAutoCompleteBox.SearchText);
        }

No answers yet. Maybe you can help?

Tags
AutoCompleteBox
Asked by
Avani
Top achievements
Rank 1
Share this question
or