Esempio n. 1
0
        private void SearchText_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
        {
            string keyword = SearchText.Text.Trim();

            foreach (ListBoxItem c in ImageListBox.Items)
            {
                ImageSelectItem d = c.Content as ImageSelectItem;
                if (d.InfoText.Text.Contains(keyword))
                {
                    c.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    c.Visibility = System.Windows.Visibility.Collapsed;
                }
            }
            ImageListBox.UpdateLayout();
        }
Esempio n. 2
0
 public void BindData(List <string> imageResources, string currentImage)
 {
     ImageResources = imageResources;
     ImageListBox.Items.Clear();
     foreach (var img in imageResources)
     {
         ImageSelectItem c = new ImageSelectItem();
         c.Image.Source  = ResourceManager.GetImage(img);
         c.InfoText.Text = string.Format("{0}({1})", img, ResourceManager.Get(img));
         c.Path          = img;
         ListBoxItem item = new ListBoxItem()
         {
             Content = c
         };
         ImageListBox.Items.Add(item);
         if (img.Equals(currentImage))
         {
             ImageListBox.SelectedItem = item;
         }
     }
 }