0
我已經使用ff掛鉤了ListBoxItems的雙擊事件。代碼我的XAML:雙擊選中所有的ListBoxItems
<Style TargetType="{x:Type ListBoxItem}">
<EventSetter Event="MouseDoubleClick" Handler="onMouseDoubleClickOnListBoxItem" />
</Style>
該處理程序的代碼是:
private void onMouseDoubleClickOnListBoxItem(object sender, MouseButtonEventArgs e)
{
Debug.Print("Going to select all.");
listBox.SelectAll();
Debug.Print("Selected all.");
}
當我運行它,我看到了調試輸出,但內容並非全都在屏幕上得到選擇。
selectionMode是已經在延長。 – 2010-10-19 03:38:32
是的,但我認爲在擴展模式下執行雙擊的項目會重置爲selecteditem。我不確定這個沒有設置來驗證。 – whoisthis 2010-10-19 03:50:08
對不起,你是對的。多選作爲選擇模式產生更好的行爲。但仍有一項未選中:我雙擊的項目。另外,我需要使用擴展選擇模式。如果你用兩者的解決方案來編輯你的答案,我可以撤消投票並接受你的答案。 – 2010-10-19 05:12:03