User Guide > How to Work with... > Windows Presentation Foundation (WPF) > XAML GUI Controls and Templates > Thumbnail > ImGearThumbnailCtl |
The following template defines ImGearThumbnailCtl Class style and consists of ScrollViewer with binding, ScrollBarVisibility dependency property, and ListBox control with another binded property (SelectionMode), items source (ItemsSource="{Binding Path = Thumbnails}") and overridden styles, called ThumbnailListBoxItemStyle for generic items and ThumbnailListBoxStyle for ListBox itself.
XAML |
Copy Code |
---|---|
<Style TargetType="{x:Type local:ImGearThumbnailCtl} <Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="VerticalAlignment" Value="Stretch"/> <Setter Property="Template <Setter.Value> <ControlTemplate TargetType="{x:Type local:ImGearThumbnailCtl} <ScrollViewer VerticalScrollBarVisibility="{Binding ScrollBarVisibility}" HorizontalScrollBarVisibility="Disabled" Background ="{Binding Background} <ListBox IsSynchronizedWithCurrentItem="True" Name="ThumbnailListBox" SelectedIndex="0" SelectionMode="{Binding SelectionMode}" Style ="{StaticResource ThumbnailListBoxStyle}" ItemsSource="{Binding Path = Thumbnails}" ItemContainerStyle = "{StaticResource ThumbnailListBoxItemStyle}" > </ListBox> </ScrollViewer> </ControlTemplate> </Setter.Value> </Setter> </Style> |