Selected item of a Ribbon DropdownButton

Dears, I'm not able to bind the selecteditem of a Ribbon DropDownButton.
My source code is the following:
<syncfusion:DropDownButton Label="Strategy" ItemsSource="{Binding StrategyList}" DisplayMemberPath="Text" AllowDrop="True" Name="dd_strategy" SizeForm="Large" LargeIcon="/Images/StrategyLarge.png"  />
 
Items are filled in correctly, but I do not understand how to get the selected item.

In similar way I created a Combobox and for this the SelectedItem event is available so everything works fine.
<syncfusion:RibbonComboBox  ItemsSource="{Binding StrategyList}"  SelectedItem="{Binding StrategySelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"  x:Name="cmb_Strategy" Margin="0,0,6,0" Width="140">
                        <syncfusion:RibbonComboBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding Text}" Padding="5" Height="20"/>
                                </StackPanel>
                            </DataTemplate>
                            </syncfusion:RibbonComboBox.ItemTemplate>
                    </syncfusion:RibbonComboBox >

How to do the same with DropDownButton?

Thank you very much for support.
Gianpietro

1 Reply 1 reply marked as answer

VR Vijayalakshmi Roopkumar Syncfusion Team March 25, 2021 04:22 PM UTC

Hi GianPierto, 
 
Thank you for contacting Syncfusion Support. 
 
We have checked the reported behavior with Ribbon and observe that you need to know about which item has been selected in Ribbon dropdownbutton. For this you need to use the following approach, and know about the selecteditem in RibbonDropdownButton, in which you invoke the selectionchanged event of listbox and know about the selected item. 
 
Code:[XAML] 
 
 
<syncfusion:DropDownButton 
HorizontalAlignment="Left" 
Label="{Binding ItemHeader}" 
SizeForm="{Binding IsLarge, Converter={StaticResource SizeFormConverter}}" 
IconTemplate="{Binding ImageTemplate}"> 
<ListBox 
x:Name="itemsList" 
BorderThickness="0" 
ItemTemplate="{StaticResource DefaultTemplate}" 
ItemsSource="{Binding Path=ModelTabDropDownItem}"> 
<interactivity:Interaction.Triggers> 
<interactivity:EventTrigger EventName="SelectionChanged"> 
<interactivity:InvokeCommandAction Command="{Binding Path=DataContext.DropDownCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" CommandParameter="{Binding ElementName=itemsList, Path=SelectedItem}" /> 
</interactivity:EventTrigger> 
</interactivity:Interaction.Triggers> 
</ListBox> 
</syncfusion:DropDownButton> 
 
  
We have attached the sample for your reference. 
 
 
Regards, 
Vijayalakshmi VR 


Marked as answer
Loader.
Up arrow icon