DropDownButton not closing when clicking outside

3 posts, 0 answers
  1. Patrick
    Patrick avatar
    372 posts
    Member since:
    Aug 2012

    Posted 06 Mar 2013 Link to this post

    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. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 08 Mar 2013 Link to this post

    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.

  3. DevCraft banner
  4. Patrick
    Patrick avatar
    372 posts
    Member since:
    Aug 2012

    Posted 09 Mar 2013 Link to this post

    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
Back to Top