wpf listBox 多列大图片效果

wpf listBox 多列大图片效果

修改ListBox的模版 多列大图片效果,加上删除button

看图

wpf listBox 多列大图片效果_第1张图片

上代码!


    
        
        
            
                
                    
                
                
                    
                
                
                    
                        
                            
                                                        
                        
                        
                        
                            
                        
                                       
                
            
        
        
    
    
        
            
            
            
                
        
            
                
                    
                        
                    
                
            
        
                    
            
            
            
                返回 Esc
            
                
    

  


#region ConverToImageInfo 把DataTable里的转换成图片 [System.Windows.Data.ValueConversion(typeof(byte[]),typeof(ImageSource))] public class ConvertToRecipesImageInfo:System.Windows.Data.IValueConverter { #region IValueConverter 成员 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { byte[] binaryimagedata=value as byte[]; if (binaryimagedata == null) return ""; using(Stream imageStreamSource =new MemoryStream(binaryimagedata,false)) { JpegBitmapDecoder jpeDecoder=new JpegBitmapDecoder(imageStreamSource,BitmapCreateOptions.PreservePixelFormat,BitmapCacheOption.OnLoad); ImageSource imageSource=jpeDecoder.Frames[0]; return imageSource; } } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } #endregion } #endregion

  

    
    

  

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ThunderSetCenterBLL.RoomSetting;
using System.Data;

namespace Thunder.SetCenter.RoomSetting
{
    /// 
    /// ActivityPhotoView.xaml 的交互逻辑
    /// 
    public partial class ActivityPhotoView : Window
    {
        #region Value
        private ActivityPrictureBLL bll_ActivityPrictureBLL = new ActivityPrictureBLL();
        #endregion


        #region Ini And WinEvent
        public ActivityPhotoView()
        {
            InitializeComponent();
        }

        public void WinLoadedEvent(object sender, RoutedEventArgs e)
        {
            BindingData();
        }
        #endregion



        #region  Add Del Binding
        /// 
        /// 绑定
        /// 
        public void BindingData()
        {
            DataTable _BingData = bll_ActivityPrictureBLL.GetAcitviPricture();
            lsPricture.ItemsSource = _BingData.DefaultView;
        }

        /// 
        /// 删除
        /// 
        /// 
        /// 
        public void Del_PrictureEvent(object sender, RoutedEventArgs e)
        {
            Button _DelBtn = sender as Button;
            int _delID = (int)_DelBtn.Tag;
        }

        public void btn_AddEvent(object sender, RoutedEventArgs e)
        {

        }

        public void hpl_Back_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        #endregion
    }
}

  

create table activePricture
(
	id int identity(1,1),
	activeName varchar(50),
	activePricture  image
)

  

posted @ 2012-11-20 11:00 lpxxn 阅读( ...) 评论( ...) 编辑 收藏

你可能感兴趣的:(wpf listBox 多列大图片效果)