GroupBar


Display a Window containing a GroupBar with a simple hierarchy of items, show a silly message when the user clicks on one of the items.



XAML


∇ xaml←GroupBarXAML;⎕IO;⎕ML
⍝ XAML for the GroupBar example
 ⎕IO ⎕ML←0 3
 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.Tools.WPF"'
 xaml,←⊂'    SizeToContent="WidthandHeight">'
 xaml,←⊂'    <StackPanel>'
 xaml,←⊂'          <sftools:GroupBar Name="gb" Height="200">'
 xaml,←⊂'           <sftools:GroupBarItem Header="ItemA">'
 xaml,←⊂'              <sftools:GroupView Width="200">'
 xaml,←⊂'                <sftools:GroupViewItem Text="ViewA" Name="gviA"/>'
 xaml,←⊂'                <sftools:GroupViewItem Text="ViewB" Name="gviB"/>'
 xaml,←⊂'              </sftools:GroupView>'
 xaml,←⊂'           </sftools:GroupBarItem>'
 xaml,←⊂'           <sftools:GroupBarItem Header="ItemB"/>'
 xaml,←⊂'           <sftools:GroupBarItem Header="ItemC"/>'
 xaml,←⊂'        </sftools:GroupBar>'
 xaml,←⊂'    </StackPanel>'
 xaml,←⊂'</Window>' 



Code


∇  GroupBar;⎕IO;⎕ML;xaml
⍝ Simple GroupBar example
 ⎕IO ⎕ML←0 3
 xaml←GroupBarXAML
 window←#.UTIL.WPF.LoadXaml xaml(⊂'SyncTools')
 window_gviA window_gviB←{window.FindName⊂⍵}¨'gviA' 'gviB'
 (window_gviA window_gviB).onClick←⊂'GroupBarYellow'
 {}window.ShowDialog



 GroupBarYellow w;⎕IO;⎕ML
⍝ Simple callback on GroupViewItem
 ⎕IO ⎕ML←0 3
 ⎕←'Ow, you clickeded ',(↑w).Name


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

'SyncFusion.Windows.Tools.Controls,Syncfusion/4.5/Syncfusion.Tools.WPF.dll

 to the ⎕USING list of LoadXAML

A couple of idiosyncracies here - notice the explicit Height and Width settings, you need to do these to give the control room to do its visual thing properly (try tweaking the code above and you'll see).
Also, unlike Button (for example) repeated clicking on the same GroupViewItem won't get the callback more than once, you have to click different things - I've no idea...

Operation


       #. #.GroupBar.GroupBar        
Ow, you clickeded gviA
Ow, you clickeded gviB
Ow, you clickeded gviA
Ow, you clickeded gviB

Unresolved Issues