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

DropDownButton not closing when clicking outside

2 Answers 256 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Patrick asked on 06 Mar 2013, 07:38 AM
Hello,
It seems that, in some scenarios, the RadDropDownButton is not closing automatically when I click outside it.
It fails even in this simple example:

1. Create a new Silverlight application.
2. Add references to Telerik.Windows.Controls.
3. Replace Page.xaml with:
<?xml version='1.0' encoding='utf-8' ?>
<UserControl
  x:Class="SilverlightApplication1.MainPage"
 
    <tk:RadDropDownButton Content="Drop down"
                          HorizontalAlignment="Center"
                          KeepOpen="False"
                          VerticalAlignment="Center">
      <tk:RadDropDownButton.DropDownContent>
        <TextBlock Text="Content" />
      </tk:RadDropDownButton.DropDownContent>
    </tk:RadDropDownButton>
 
</UserControl>

4. Run the application.
If I click on the drop down button, it opens and shows its content.
If I then click outside, the drop down button is not closed.

What's strange is that I have used this button in other scenario and it works as wanted.

Patrick

2 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 08 Mar 2013, 02:27 PM
Hi Patrick,

The reason that the drop down content is not closed in this case is that the Background property of the user control (parent of the RadDropDownButton) is not set. Hence, the click event is not registered or handled. In order to overcome this issue you can set the Background property to Transparent and the code will work as expected. Let me know if you need further assistance.

Regards,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 09 Mar 2013, 06:31 AM
Pavel,
your solution doesn't work in this case: setting the background of the UserControl is not the solution.
Instead, I had to put the RadDropDownButton inside a Grid and to set the background of the Grid to Transparent.
Thanks for pointing to the right direction.
Patrick
Tags
Buttons
Asked by
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Pavel R. Pavlov
Telerik team
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or