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



Gets or sets the style of how items are displayed in the control. Supported in Silverlight, Windows Phone 7

Syntax

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

Property Value

A ImageListItemStyle enumeration that specifies how the items are displayed in the control. Default value is ImageListItemStyle.Normal.

Example

Visual BasicCopy Code
''' This example will show the different view styles of a <see cref="ImageList"/> control.
Public Sub ImageList_ItemStyle(ByVal imageList As ImageList)
   ' Save the current view style
   Dim currentStyle As ImageListItemStyle = imageList.ItemStyle
   ' Show all the different styles available
   Dim a As Array = System.Enum.GetValues(GetType(ImageListItemStyle))
   For Each style As ImageListItemStyle In a
      imageList.ItemStyle = style
      MessageBox.Show("ItemStyle = " & style.ToString())
   Next style

   ' Restore original view style
   imageList.ItemStyle = currentStyle
End Sub
C#Copy Code
/// This example will show the different view styles of a <see cref="ImageList"/> control.
public void ImageList_ItemStyle(ImageList imageList)
{
   // Save the current view style
   ImageListItemStyle currentStyle = imageList.ItemStyle;
   // Show all the different styles available
   Array a = Enum.GetValues(typeof(ImageListItemStyle));
   foreach (ImageListItemStyle style in a)
   {
      imageList.ItemStyle = style;
      MessageBox.Show("ItemStyle = " + style.ToString());
   }

   // Restore original view style
   imageList.ItemStyle = currentStyle;
}
SilverlightCSharpCopy Code
/// This example will show the different view styles of a <see cref="ImageList"/> control.
public void ImageList_ItemStyle(ImageList imageList)
{
   // Save the current view style
   ImageListItemStyle currentStyle = imageList.ItemStyle;
   // Show all the different styles available
   Array a = GetValues(typeof(ImageListItemStyle));
   foreach (ImageListItemStyle style in a)
   {
      imageList.ItemStyle = style;
      MessageBox.Show("ItemStyle = " + style.ToString());
   }

   // Restore original view style
   imageList.ItemStyle = currentStyle;
}
SilverlightVBCopy Code
''' This example will show the different view styles of a <see cref="ImageList"/> control.
Public Sub ImageList_ItemStyle(ByVal imageList As ImageList)
   ' Save the current view style
   Dim currentStyle As ImageListItemStyle = imageList.ItemStyle
   ' Show all the different styles available
   Dim a As Array = GetValues(GetType(ImageListItemStyle))
   For Each style As ImageListItemStyle In a
      imageList.ItemStyle = style
      MessageBox.Show("ItemStyle = " & style.ToString())
   Next style

   ' Restore original view style
   imageList.ItemStyle = currentStyle
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

The ImageList control contains pre-defined styles for various ways to draw the items. It will set these predefined styles in the ItemContainerStyle property. When ImageListItemStyle.UserStyle is specified, it is up to you to set the required styles in ItemContainerStyle.

For more information, refer to the ImageListItemStyle enumeration.

Requirements

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

See Also