0

I'm trying to bind events to my LibraryBarItem, however when I finished like this, the MouseDown event will never be fired, can anybody tell me what happend?

LibraryBar folderContainer = new LibraryBar();

foreach (Image folder in states.Preparation.folders)
{
    LibraryBarItem folderItem = new LibraryBarItem();
    folderItem.MouseDown += clickFolder;
    folderItem.Content = folder;
    folderItem.Name = folder.Name;
    folderContainer.Items.Add(folderItem);
}    

static public void clickFolder(object sender, MouseButtonEventArgs e)
{
    MessageBox.Show("Come!");
}
4

1 回答 1

0

看来@Xaade 是对的,我测试发现LibraryItem 本身对click 事件做了一些事情,并且在使用MouseDoubleClick 时,它工作得很好;

于 2012-07-17T01:47:15.220 回答