2 u013235899 u013235899 于 2015.07.22 11:32 提问

wpf中listbox中添加button的问题

前台代码:











后台代码:
class UserItem
{
public UserItem(int Id, string Name, bool IsActived)
{
this.Id = Id;
this.Name = Name;
this.IsActived = IsActived;
}
public int Id { get; set; }
public string Name { get; set; }
public bool IsActived { get; set; }
public string BackGround
{
get
{
return IsActived
? "/image/PersonAddWhite.png"
: "/image/PersonAddBlack.png";
}
}

             public Window()
    {
        InitializeComponent();
        Lst.ItemsSource = new List<UserItem>   
{  
    new UserItem(1,"张三",true)  
    ,new UserItem(2,"李四",true)  
    ,new UserItem(3,"赵五",true)  
    ,new UserItem(4,"钱六",true)  
    ,new UserItem(5,"孙七",false)  
    ,new UserItem(6,"李八",false)  
    ,new UserItem(7,"王九",false)  
    ,new UserItem(8,"陈十",false)  
    ,new UserItem(9,"吴万",false)  
    ,new UserItem(10,"刘十八",false)  
};  
    }


            如何通过单击button来在后台得到对应item的信息,如姓名,id等。

            跪求各位大神解答!!!!

1个回答

CSDNXIAON
CSDNXIAON   2015.07.22 11:36

为Button 添加图片---WPF
为Button 添加图片---WPF
WPF中button的trigger问题
----------------------同志你好,我是CSDN问答机器人小N,奉组织之命为你提供参考答案,编程尚未成功,同志仍需努力!

Csdn user default icon
上传中...
上传图片
插入图片