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

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

2 Answers 146 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
tomas
Top achievements
Rank 1
tomas asked on 06 Jan 2014, 06:16 PM

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 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 07 Jan 2014, 04:10 PM
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">
</StackPanel>

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.

Regards,
Martin Ivanov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
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 >>
0
tomas
Top achievements
Rank 1
answered on 07 Jan 2014, 04:13 PM

Hello Martin,

Perfect, I understand.

Thank you very much.

Tom

Tags
Buttons
Asked by
tomas
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
tomas
Top achievements
Rank 1
Share this question
or