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

(incomplete image - shows the menu options when clicked)


∇ xaml←SplitButtonAdvXAML
⍝ XAML for the SplitButtonAdv example
 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:SplitButtonAdv Label="Press Here...">'
 xaml,←⊂'           <sftools:DropDownMenuGroup>'
 xaml,←⊂'               <sftools:DropDownMenuItem Header="Menu Item 1" Name="splmenu1"/>'
 xaml,←⊂'               <sftools:DropDownMenuItem Header="Menu Item 2" Name="splmenu2"/>'
 xaml,←⊂'               <sftools:DropDownMenuItem Header="Menu Item 3" Name="splmenu3"/>'
 xaml,←⊂'           </sftools:DropDownMenuGroup>'
 xaml,←⊂'        </sftools:SplitButtonAdv>'
 xaml,←⊂'    </StackPanel>'


∇  SplitButtonAdv;⎕IO;⎕ML;xaml
⍝ Simple SplitButtonAdv example
 ⎕IO ⎕ML←0 3
 #.window←#.UTIL.WPF.LoadXaml xaml(⊂'SyncTools')
 window_mnu1 window_mnu2 window_mnu3←{#.window.FindName⊂⍵}¨'splmenu1' 'splmenu2' 'splmenu3'
 (window_mnu1 window_mnu2 window_mnu3).onClick←⊂'#.SplitButtonAdv.Click'

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

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


 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.


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.