LEADTOOLS WPF and Silverlight (Leadtools.Windows.Controls assembly)
LEAD Technologies, Inc

ItemBorderBrush Property

Example 





Gets or sets the brush used to draw the border of each item. .NET support Silverlight support
Syntax
public Brush ItemBorderBrush {get; set;}
'Declaration
 
Public Property ItemBorderBrush As Brush
'Usage
 
Dim instance As ImageList
Dim value As Brush
 
instance.ItemBorderBrush = value
 
value = instance.ItemBorderBrush
public Brush ItemBorderBrush {get; set;}
 get_ItemBorderBrush();
set_ItemBorderBrush(value);
public:
property Brush^ ItemBorderBrush {
   Brush^ get();
   void set (    Brush^ value);
}

Property Value

A System.Windows.Media.Brush that is used draw the border of each item. Default value is a black System.Windows.Media.SolidColorBrush.
Example
Copy CodeCopy Code  
Private Class MyWindow2 : Inherits Window
      Public imageList As ImageList
      Public Sub New(ByVal title As String)
         title = title
         ' Set the size of the window
         Width = 400
         Height = 200

         ' Create a new ImageList control.
         imageList = New ImageList()
         imageList.Width = Double.NaN
         imageList.Height = Double.NaN

         imageList.Background = New RadialGradientBrush(Colors.DarkGray, Colors.LightGray)

         imageList.ItemBorderBrush = Brushes.Yellow
         imageList.ItemStyle = ImageListItemStyle.Normal
         imageList.ItemBorderThickness = New Thickness(5)
         imageList.ItemMargin = New Thickness(10)

         imageList.ItemSize = New Size(250, 250)
         imageList.ItemImageSize = New Size(200, 200)

         imageList.ItemSelectedForeground = Brushes.Blue
         imageList.ItemSelectedBackground = Brushes.White
         imageList.BorderThickness = New Thickness(5)


         ' Create three items
         Dim imagesPath As String = LEAD_VARS.ImagesDir

         For i As Integer = 0 To 2
            ' Load the image
            Dim index As Integer = i + 1
            Dim imageFileName As String = Path.Combine(imagesPath, "ImageProcessingDemo\Image" & index.ToString() & ".jpg")

            Dim item As ImageListItem = New ImageListItem()
            item.Source = New BitmapImage(New Uri(imageFileName))
            item.Text = "item" & index.ToString()


            ' Select the first item
            If i = 0 Then
               item.IsSelected = True
            End If

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

         ' Add the ImageList to the Window.
         Content = imageList
      End Sub
   End Class

   Public Sub ImageList_ItemBorderBrush(ByVal title As String)
      Dim window As MyWindow2 = New MyWindow2(title)
      window.ShowDialog()
   End Sub

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
class MyWindow2 : Window
   {
      public ImageList imageList;
      public MyWindow2(string title)
      {
         Title = title;
         // Set the size of the window
         Width = 400;
         Height = 200;

         // Create a new ImageList control.
         imageList = new ImageList();
         imageList.Width = Double.NaN;
         imageList.Height = Double.NaN;

         imageList.Background = new RadialGradientBrush(Colors.DarkGray, Colors.LightGray);

         imageList.ItemBorderBrush = Brushes.Yellow;
         imageList.ItemStyle = ImageListItemStyle.Normal;
         imageList.ItemBorderThickness = new Thickness(5);
         imageList.ItemMargin = new Thickness(10);

         imageList.ItemSize = new Size(250, 250);
         imageList.ItemImageSize = new Size(200, 200);

         imageList.ItemSelectedForeground = Brushes.Blue;
         imageList.ItemSelectedBackground = Brushes.White;
         imageList.BorderThickness = new Thickness(5);


         // Create three items
         string imagesPath = LEAD_VARS.ImagesDir;

         for (int i = 0; i < 3; i++)
         {
            // Load the image
            int index = i + 1;
            string imageFileName = Path.Combine(imagesPath, @"ImageProcessingDemo\Image" + index.ToString() + ".jpg");

            ImageListItem item = new ImageListItem();
            item.Source = new BitmapImage(new Uri(imageFileName));
            item.Text = "item" + index.ToString();


            // Select the first item
            if (i == 0)
               item.IsSelected = true;

            // Add the item to the image list
            imageList.Items.Add(item);
         }

         // Add the ImageList to the Window.
         Content = imageList;
      }
   }

   public void ImageList_ItemBorderBrush(string title)
   {
      MyWindow2 window = new MyWindow2(title);
      window.ShowDialog();
   }

static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
class MyWindow2 : ChildWindow
{
   public ImageList imageList;
   public MyWindow2(string title)
   {
      Title = title;
      // Set the size of the window
      Width = 400;
      Height = 200;

      // Create a new ImageList control.
      imageList = new ImageList();
      imageList.Width = Double.NaN;
      imageList.Height = Double.NaN;

      imageList.Background = new RadialGradientBrush(Colors.DarkGray, Colors.LightGray);

      imageList.ItemBorderBrush = new SolidColorBrush(Colors.Yellow);
      imageList.ItemStyle = ImageListItemStyle.Normal;
      imageList.ItemBorderThickness = new Thickness(5);
      imageList.ItemMargin = new Thickness(10);

      imageList.ItemSize = new Size(250, 250);
      imageList.ItemImageSize = new Size(200, 200);

      imageList.ItemSelectedForeground = new SolidColorBrush(Colors.Blue);
      imageList.ItemSelectedBackground = new SolidColorBrush(Colors.White);
      imageList.BorderThickness = new Thickness(5);


      // Create three items
      string imagesPath = LeadtoolsExamples.Common.ImagesPath.Path;

      for (int i = 0; i < 3; i++)
      {
         // Load the image
         int index = i + 1;
         string imageFileName = imagesPath + "Image" + index.ToString() + ".jpg";

         ImageListItem item = new ImageListItem();
         item.Source = new BitmapImage(new Uri(imageFileName));
         item.Text = "item" + index.ToString();


         // Select the first item
         if (i == 0)
            item.IsSelected = true;

         // Add the item to the image list
         imageList.Items.Add(item);
      }

      // Add the ImageList to the Window.
      Content = imageList;
   }
}

public void ImageList_ItemBorderBrush(string title)
{
   MyWindow2 window = new MyWindow2(title);
   window.Show();
}
Private Class MyWindow2 : Inherits ChildWindow
   Public imageList As ImageList
   Public Sub New(ByVal title As String)
      title = title
      ' Set the size of the window
      Width = 400
      Height = 200

      ' Create a new ImageList control.
      imageList = New ImageList()
      imageList.Width = Double.NaN
      imageList.Height = Double.NaN

      imageList.Background = New RadialGradientBrush(Colors.DarkGray, Colors.LightGray)

      imageList.ItemBorderBrush = New SolidColorBrush(Colors.Yellow)
      imageList.ItemStyle = ImageListItemStyle.Normal
      imageList.ItemBorderThickness = New Thickness(5)
      imageList.ItemMargin = New Thickness(10)

      imageList.ItemSize = New Size(250, 250)
      imageList.ItemImageSize = New Size(200, 200)

      imageList.ItemSelectedForeground = New SolidColorBrush(Colors.Blue)
      imageList.ItemSelectedBackground = New SolidColorBrush(Colors.White)
      imageList.BorderThickness = New Thickness(5)


      ' Create three items
      Dim imagesPath As String = LeadtoolsExamples.Common.ImagesPath.Path

      For i As Integer = 0 To 2
         ' Load the image
         Dim index As Integer = i + 1
         Dim imageFileName As String = imagesPath & "Image" & index.ToString() & ".jpg"

         Dim item As ImageListItem = New ImageListItem()
         item.Source = New BitmapImage(New Uri(imageFileName))
         item.Text = "item" & index.ToString()


         ' Select the first item
         If i = 0 Then
            item.IsSelected = True
         End If

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

      ' Add the ImageList to the Window.
      Content = imageList
   End Sub
End Class

Public Sub ImageList_ItemBorderBrush(ByVal title As String)
   Dim window As MyWindow2 = New MyWindow2(title)
   window.Show()
End Sub
<Window
    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"
    Height="600" Width="800" Title="ItemBorderBrush Sample">
  <DockPanel>
    <Leadtools_Windows_Controls:ImageList
        Name="theImageList"
        DockPanel.Dock= "Bottom"
        HorizontalAlignment="Center" VerticalAlignment="Bottom" ItemBorderBrush="Red" ItemSelectedForeground="Blue" ItemSelectedBackground="Yellow">
      <Leadtools_Windows_Controls:ImageListItem Source="file:///c:\users\Public\Documents\LEADTOOLS Images\cannon.jpg" Text="slave.jpg"/>
      <Leadtools_Windows_Controls:ImageListItem Source="file:///c:\users\Public\Documents\LEADTOOLS Images\clean.tif" Text="clean.tif"/>
    </Leadtools_Windows_Controls:ImageList>
  </DockPanel>
</Window>
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ImageList Class
ImageList Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.