should radsplitbutton close the dropdown part when the user clicks somewhere outside the dropdown part?

3 posts, 0 answers
  1. tomas
    tomas avatar
    139 posts
    Member since:
    Sep 2012

    Posted 06 Jan 2014 Link to this post

    Well, I have read somewhere in this forum, that yes, the dropdown part should be closed.

    My splitbutton will not close when I click on the stackpanel free space.

    <StackPanel Name="root" Orientation="Vertical" ><br>
    <br>  <telerik:RadSplitButton Name="splitButton" HorizontalAlignment="Left" DropDownButtonPosition="Right" IsBackgroundVisible="False" Margin="50" Click="RadSplitButton_Click"><br>
    <br>   <telerik:RadSplitButton.Content><br>
    <br>    <Image Source="/images/32/control_play_blue.png" Stretch="None" /><br>
    <br>   </telerik:RadSplitButton.Content><br>
    <br>   <telerik:RadSplitButton.DropDownContent><br>
    <br>    <ListBox Width="auto" BorderThickness="0"><br>
    <br>     <ListBoxItem Content="Spustit" /><br>
    <br>     <ListBoxItem Content="Spustit a ukázat v nové záložce" /><br>
    <br>    </ListBox><br>
    <br>   </telerik:RadSplitButton.DropDownContent><br>
    <br>  </telerik:RadSplitButton><br>
    <br> </StackPanel>
    Thank you Tomas

    Thank you Tomas

  2. Martin Ivanov
    Martin Ivanov avatar
    2216 posts

    Posted 07 Jan 2014 Link to this post

    Hello Tomas,

    You should set the StackPanel Background property in order to close the RadSplitButton DropDownContent when you click outside the control.

    <StackPanel Name="root" Background="Transparent" Orientation="Vertical">

    The reason for this requirement is that by default the Background property has value of Null. Elements with Null background cannot receive the mouse click events and therefore the SplitButton can't detect that it has to close its DropDown.

    If, on the other hand, you want to close the ListBox when you select one of its items you can use the RadSplitButton IsOpen property, which controls the visual state of the DropDownContent.  In your case, you can set RadSplitButton.IsOpen to False in the SelectionChanged event handler of the ListBox to close the drop down content when a ListBoxItem is clicked.

    Martin Ivanov
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. tomas
    tomas avatar
    139 posts
    Member since:
    Sep 2012

    Posted 07 Jan 2014 Link to this post

    Hello Martin,

    Perfect, I understand.

    Thank you very much.


Back to Top