private void DirectoriesTreeView_OnItemMouseDoubleClick(object sender, MouseButtonEventArgs e) { var item = sender as TreeViewItem; if (item == null) { return; } if (!item.IsSelected) { return; } TreeItem.OpenFile((TreeItem)item.DataContext); }