LEADTOOLS WPF and Silverlight (Leadtools.Windows.Controls assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.30
Orientation Property
See Also 
Leadtools.Windows.Controls Namespace > ImageList Class : Orientation Property



Gets or sets the direction the ImageList control scrolls the displayed items. Supported in Silverlight, Windows Phone 7

Syntax

Visual Basic (Declaration) 
<DescriptionAttribute("Orientation for each item.")>
<CategoryAttribute("Appearance")>
Public Property Orientation As Orientation
Visual Basic (Usage)Copy Code
Dim instance As ImageList
Dim value As Orientation
 
instance.Orientation = value
 
value = instance.Orientation
C# 
[DescriptionAttribute("Orientation for each item.")]
[CategoryAttribute("Appearance")]
public Orientation Orientation {get; set;}
C++/CLI 
[DescriptionAttribute("Orientation for each item.")]
[CategoryAttribute("Appearance")]
public:
property Orientation Orientation {
   Orientation get();
   void set (    Orientation value);
}

Property Value

An System.Windows.Controls.Orientation enumeration that specifies the direction the ImageList control scrolls the displayed items. Default value is Orientation.Horizontal.

Example

Visual BasicCopy Code
Public Sub ImageList_Orientation(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()
      item.Text = "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(Orientation))
   For Each style As Orientation In a
      imageList.Orientation = style
      MessageBox.Show("Orientation = " & style.ToString())
   Next style

   ' Set vertical scrolling style
   imageList.Orientation = Orientation.Vertical
End Sub
C#Copy Code
public void ImageList_Orientation(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();
      item.Text = "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(Orientation));
   foreach (Orientation style in a)
   {
      imageList.Orientation = style;
      MessageBox.Show("Orientation = " + style.ToString());
   }

   // Set vertical scrolling style
   imageList.Orientation = Orientation.Vertical;
}
SilverlightCSharpCopy Code
public void ImageList_Orientation(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();
      item.Text = "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 = GetValues(typeof(Orientation));
   foreach (Orientation style in a)
   {
      imageList.Orientation = style;
      MessageBox.Show("Orientation = " + style.ToString());
   }

   // Set vertical scrolling style
   imageList.Orientation = Orientation.Vertical;
}
SilverlightVBCopy Code
Public Sub ImageList_Orientation(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()
      item.Text = "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 = GetValues(GetType(Orientation))
   For Each style As Orientation In a
      imageList.Orientation = style
      MessageBox.Show("Orientation = " & style.ToString())
   Next style

   ' Set vertical scrolling style
   imageList.Orientation = Orientation.Vertical
End Sub
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">
  <DockPanel>
    <Leadtools_Windows_Controls:ImageList Margin="8,46,8,196" HorizontalContentAlignment="Center" VerticalContentAlignment="Top" Orientation="Vertical" ShowText="False" ItemForeground="#FF000000" ItemStyle="Normal" ItemBorderThickness="2,2,2,2" ItemMargin="0,0,0,0" ItemSize="120,128" ItemImageSize="102,102" DockPanel.Dock="Left">
      <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 Source="file:///c:\users\Public\Documents\LEADTOOLS Images\cannon.jpg">
        <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 Source="file:///c:\users\Public\Documents\LEADTOOLS Images\cannon.jpg">
        <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" Source="file:///c:\users\Public\Documents\LEADTOOLS Images\eye.gif" />
    </Leadtools_Windows_Controls:ImageList>
  </DockPanel>
</Window>

Remarks

When the value of this property is Orientation.Horizontal, the items are added in the control till all the horizontal space is filled, items then will be added in the next "row" and a vertical scrollbar might become visible and functional.

When the value of this property is Orientation.Vertical, the items are added in the control till all the vertical space is filled, items then will be added in the next "column" and a horizontal scrollbar might become visible and functional.

Requirements

Target Platforms: Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also