Leadtools.Windows.Controls Send comments on this topic. | Back to Introduction - LEADTOOLS WPF | Help Version 16.5.9.25
ScrollStyle Property
See Also  Example
Leadtools.Windows.Controls Namespace > ImageList Class : ScrollStyle Property





Specifies the direction the ImageList Control scrolls the displayed items. This is a dependency property.

Syntax

Visual Basic (Declaration) 
Public Property ScrollStyle As ImageListScrollStyle
Visual Basic (Usage)Copy Code
Dim instance As ImageList
Dim value As ImageListScrollStyle
 
instance.ScrollStyle = value
 
value = instance.ScrollStyle
C# 
public ImageListScrollStyle ScrollStyle {get; set;}
C++/CLI 
public:
property ImageListScrollStyle ScrollStyle {
   ImageListScrollStyle get();
   void set (ImageListScrollStyle value);
}
XAML Attributes Usage 

<object ScrollStyle=Leadtools.Windows.Controls.ImageListScrollStyle .../>

Dependencies Property Information 

Identifier field

ScrollStyleProperty

Metadata properties set to true

None

XAML Attributes Usage 

<object ScrollStyle=Leadtools.Windows.Controls.ImageListScrollStyle .../>

Dependencies Property Information 

Identifier field

ScrollStyleProperty

Metadata properties set to true

None

Return Value

An ImageListScrollStyle enumeration value that specifies the direction the ImageList Control scrolls the displayed items. Default value is ImageListScrollStyle.Vertical.

Example

This example fills an ImageList control with 10 items. It will then show the difference between vertical and horizontal scrolling styles.

Visual BasicCopy Code
Public Sub ImageList_ScrollStyle(ByVal imageList As ImageList)
    ' Clear out any items in the image list
    imageList.Items.Clear()
    ' Create 20 items
    For i As Integer = 0 To 19
        ' Load the image
        Dim index As Integer = i + 1
        Dim item As ImageListItem = New ImageListItem(Nothing, "Item" & index.ToString())

        ' Select every otehr item
        If (i Mod 2) = 0 Then
            item.IsSelected = True
        End If

        ' Add the item to the image list
        imageList.Items.Add(item)
    Next i

    Dim a As Array = System.Enum.GetValues(GetType(ImageListScrollStyle))
    For Each style As ImageListScrollStyle In a
        imageList.ScrollStyle = style
        MessageBox.Show("ScrollStyle = " & style.ToString())
    Next style

    ' Set vertical scrolling style
    imageList.ScrollStyle = ImageListScrollStyle.Vertical
End Sub
C#Copy Code
public void ImageList_ScrollStyle(ImageList imageList) 

   // Clear out any items in the image list 
   imageList.Items.Clear(); 
   // Create 20 items 
   for (int i = 0; i < 20; i++) 
   { 
      // Load the image 
      int index = i + 1; 
      ImageListItem item = new ImageListItem(null, "Item" + index.ToString()); 
 
      // Select every otehr item 
      if ((i % 2) == 0) 
         item.IsSelected = true; 
 
      // Add the item to the image list 
      imageList.Items.Add(item); 
   } 
 
   Array a = Enum.GetValues(typeof(ImageListScrollStyle)); 
   foreach (ImageListScrollStyle style in a) 
   { 
      imageList.ScrollStyle = style; 
      MessageBox.Show("ScrollStyle = " + style.ToString()); 
   } 
 
   // Set vertical scrolling style 
   imageList.ScrollStyle = ImageListScrollStyle.Vertical; 
}
XAMLCopy Code
<Window x:Class="ScrollStyle.Window1" x:Name="Window" Title="Window1" Width="640" Height="480" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Leadtools_Windows_Controls="clr-namespace:Leadtools.Windows.Controls;assembly=Leadtools.Windows.Controls" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic"> 
  <Window.Resources> 
    <Style x:Key="ImageListStyle1" TargetType="{x:Type Leadtools_Windows_Controls:ImageList}"> 
      <Setter Property="Template"> 
        <Setter.Value> 
          <ControlTemplate TargetType="{x:Type Leadtools_Windows_Controls:ImageList}"> 
            <Microsoft_Windows_Themes:ClassicBorderDecorator SnapsToDevicePixels="True" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderStyle="Sunken" BorderThickness="{TemplateBinding BorderThickness}" Height="165"> 
              <ScrollViewer Height="Auto" BorderBrush="#FF002F95"> 
                <ScrollViewer.Background> 
                  <LinearGradientBrush EndPoint="0.503,-0.273" StartPoint="0.503,1"> 
                    <GradientStop Color="#FF032A62" Offset="0" /> 
                    <GradientStop Color="#FFDCDCDC" Offset="0.533" /> 
                  </LinearGradientBrush> 
                </ScrollViewer.Background> 
                <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Visibility="Visible" Height="Auto" RenderTransformOrigin="0.5,0.5" Width="Auto" OpacityMask="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center"> 
                  <ItemsPresenter.RenderTransform> 
                    <TransformGroup> 
                      <ScaleTransform ScaleX="-1" ScaleY="1" /> 
                      <SkewTransform AngleX="0" AngleY="0" /> 
                      <RotateTransform Angle="0" /> 
                      <TranslateTransform X="0" Y="0" /> 
                    </TransformGroup> 
                  </ItemsPresenter.RenderTransform> 
                </ItemsPresenter> 
              </ScrollViewer> 
            </Microsoft_Windows_Themes:ClassicBorderDecorator> 
            <ControlTemplate.Triggers> 
              <Trigger Property="ScrollStyle" Value="Vertical"> 
                <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> 
                <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" /> 
              </Trigger> 
              <Trigger Property="ScrollStyle" Value="Horizontal"> 
                <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" /> 
                <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" /> 
              </Trigger> 
            </ControlTemplate.Triggers> 
          </ControlTemplate> 
        </Setter.Value> 
      </Setter> 
      <Style.Triggers> 
        <Trigger Property="ScrollStyle" Value="Vertical"> 
          <Setter Property="ItemsPanel"> 
            <Setter.Value> 
              <ItemsPanelTemplate> 
                <WrapPanel IsItemsHost="True" Orientation="Horizontal" /> 
              </ItemsPanelTemplate> 
            </Setter.Value> 
          </Setter> 
        </Trigger> 
        <Trigger Property="ScrollStyle" Value="Horizontal"> 
          <Setter Property="ItemsPanel"> 
            <Setter.Value> 
              <ItemsPanelTemplate> 
                <WrapPanel IsItemsHost="True" Orientation="Vertical" /> 
              </ItemsPanelTemplate> 
            </Setter.Value> 
          </Setter> 
        </Trigger> 
      </Style.Triggers> 
    </Style> 
  </Window.Resources> 
  <Grid x:Name="LayoutRoot"> 
    <Leadtools_Windows_Controls:ImageList IsSynchronizedWithCurrentItem="True" Margin="8,46,8,196" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Visible" HorizontalContentAlignment="Center" VerticalContentAlignment="Top" Grid.IsSharedSizeScope="False" ScrollViewer.CanContentScroll="False" ScrollStyle="Vertical" Style="{DynamicResource ImageListStyle1}" ShowText="False" ItemForeground="#FF000000" ViewStyle="Normal" ItemBorderThickness="2,2,2,2" ItemMargin="0,0,0,0" ItemSize="120,128" ImageSize="102,102"> 
      <Leadtools_Windows_Controls:ImageList.ItemBackground> 
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> 
          <GradientStop Color="#FFFFFFFF" Offset="0.329" /> 
          <GradientStop Color="#FF415C85" Offset="0.548" /> 
        </LinearGradientBrush> 
      </Leadtools_Windows_Controls:ImageList.ItemBackground> 
      <Leadtools_Windows_Controls:ImageList.ItemSelectedBackground> 
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> 
          <GradientStop Color="#FFF7F7F7" Offset="0.038" /> 
          <GradientStop Color="#FFC9E00B" Offset="1" /> 
        </LinearGradientBrush> 
      </Leadtools_Windows_Controls:ImageList.ItemSelectedBackground> 
      <Leadtools_Windows_Controls:ImageListItem Image="eye.gif"> 
        <Leadtools_Windows_Controls:ImageListItem.Background> 
          <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> 
            <GradientStop Color="#FFFCFDFD" Offset="0.258" /> 
            <GradientStop Color="#FF2798D8" Offset="1" /> 
            <GradientStop Color="#FE000101" Offset="0.498" /> 
            <GradientStop Color="#FE01080B" Offset="0.058" /> 
            <GradientStop Color="#FEFFFFFF" Offset="0.738" /> 
          </LinearGradientBrush> 
        </Leadtools_Windows_Controls:ImageListItem.Background> 
      </Leadtools_Windows_Controls:ImageListItem> 
      <Leadtools_Windows_Controls:ImageListItem Image="eye.gif"> 
        <Leadtools_Windows_Controls:ImageListItem.Background> 
          <LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1"> 
            <GradientStop Color="#FF000000" Offset="0" /> 
            <GradientStop Color="#FFC1D836" Offset="1" /> 
          </LinearGradientBrush> 
        </Leadtools_Windows_Controls:ImageListItem.Background> 
      </Leadtools_Windows_Controls:ImageListItem> 
      <Leadtools_Windows_Controls:ImageListItem Content="ImageListItem" ScrollViewer.HorizontalScrollBarVisibility="Visible" Image="eye.gif" /> 
    </Leadtools_Windows_Controls:ImageList> 
  </Grid> 
</Window>

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003 family

See Also