DropDownButtonAdv


Display a Window containing a DropDownButtonAdv with three menu options, respond to the user clicking on any of these options.



(incomplete image - shows the menu options when clicked)

XAML


∇  xaml←DropDownButtonAdvXAML
⍝ XAML for the DropDownButtonAdv example
 xaml←⊂'<Window'
 xaml,←⊂'    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"'
 xaml,←⊂'    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"'
 xaml,←⊂'    xmlns:sftools="clr-namespace:Syncfusion.Windows.Tools.Controls;assembly=SyncFusion.Shared.WPF"'
 xaml,←⊂'    SizeToContent="WidthandHeight" >'
 xaml,←⊂'    <StackPanel>'
 xaml,←⊂'        <sftools:DropDownButtonAdv Label="Press Here...">'
 xaml,←⊂'           <sftools:DropDownMenuGroup>'
 xaml,←⊂'               <sftools:DropDownMenuItem Header="Menu Item 1" Name="ddmenu1"/>'
 xaml,←⊂'               <sftools:DropDownMenuItem Header="Menu Item 2" Name="ddmenu2"/>'
 xaml,←⊂'               <sftools:DropDownMenuItem Header="Menu Item 3" Name="ddmenu3"/>'
 xaml,←⊂'           </sftools:DropDownMenuGroup>'
 xaml,←⊂'        </sftools:DropDownButtonAdv>'
 xaml,←⊂'    </StackPanel>'
 xaml,←⊂'</Window>' 


Code


∇ DropDownButtonAdv;⎕IO;⎕ML;xaml
⍝ Simple DropDownButtonAdv example
 ⎕IO ⎕ML←0 3
 xaml←DropDownButtonAdvXAML
 #.window←#.UTIL.WPF.LoadXaml xaml(⊂'SyncTools')
 window_mnu1 window_mnu2 window_mnu3←{#.window.FindName⊂⍵}¨'ddmenu1' 'ddmenu2' 'ddmenu3'
 (window_mnu1 window_mnu2 window_mnu3).onClick←⊂'#.DropDownButtonAdv.Click'
 #.window.Show


∇  Click w;⎕IO;⎕ML
⍝ Callback for Click on a DropDown menu item
 ⎕IO ⎕ML←0 3
 ⎕←'You chose option ',⍕'ddmenu1' 'ddmenu2' 'ddmenu3'⍳⊂(↑w).Name


The 'SyncTools' argument to #.UTIL.LoadXAML has the effect of adding

    'Syncfusion.Windows.Shared,Syncfusion/4.5/Syncfusion.Shared.WPF.dll'
    'Syncfusion.Tools.WPF,Syncfusion/4.5/Syncfusion.Tools.WPF.dll'
    'Syncfusion.SfInput.WPF,Syncfusion/4.5/Syncfusion.SfInput.WPF.dll'

 to the ⎕USING list of LoadXAML


In practice it would probably be useful to add the menu items programmatically rather than wire them into the XAML - at least in the case where the number of items is data-determined.

Operation


      #.DropDownButtonAdv.DropDownButtonAdv
You chose option 1
You chose option 0

Unresolved Issues


It's not clear at this time what the differences are between DropDownButtonAdv and SplitButtonAdv.
Explore more properties.