Gallery


Given a set of (image) files, display their thumbnails and allow the user to select one



XAML


∇   xaml←GalleryXAML
⍝ XAML for the Gallery 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.Tools.WPF"'
 xaml,←⊂'    SizeToContent="WidthandHeight" >'
 xaml,←⊂'    <StackPanel>'
 xaml,←⊂'        <sftools:Gallery Width="200">'
 xaml,←⊂'          <sftools:GalleryGroup Name="gallerygroup"/>'
 xaml,←⊂'        </sftools:Gallery>'
 xaml,←⊂'    </StackPanel>'
 xaml,←⊂'</Window>'


Code


∇ z←Gallery(header files);⎕IO;⎕ML;xaml;file;image;gi;uri
⍝ Simple Gallery example
 ⎕IO ⎕ML←0 3
 xaml←GalleryXAML
 #.window←#.UTIL.WPF.LoadXaml xaml(⊂'SyncTools')
 window_gallerygroup←#.window.FindName⊂'gallerygroup'
 window_gallerygroup.Header←header
 :For file :In files
     image←⎕NEW Image
     uri←⎕NEW Uri(⊂file)
     image.Source←⎕NEW BitmapImage(⊂uri)
     {}window_gallerygroup.Items.Add image
 :EndFor
 {}#.window.ShowDialog
 z←window_gallerygroup.SelectionStartIndex



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

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

 to the ⎕USING list of
LoadXAML

The SyncFusion documentation suggests that something more complex should be required, but the above seems adequate.

Operation


      #.Gallery.Gallery'Three Mangy Moggs' ((⊂'d:\dick\temp\pic'),¨'0.jpg' '1.jpg' '2.jpg')


Unresolved Issues


More control over appearance
Multiple selections (not quite sure why there's a SelectionStartIndex and not - apparently - a SelectionEndIndex)