Files
QuickLook/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFileListView.xaml.cs
Paddy Xu f11c59be01 ..
2017-04-30 02:27:07 +03:00

50 lines
1.2 KiB
C#

using System;
using System.Windows.Controls;
namespace QuickLook.Plugin.ArchiveViewer
{
/// <summary>
/// Interaction logic for ArchiveFileListView.xaml
/// </summary>
public partial class ArchiveFileListView : UserControl, IDisposable
{
public ArchiveFileListView()
{
InitializeComponent();
}
public void Dispose()
{
GC.SuppressFinalize(this);
IconManager.ClearCache();
}
~ArchiveFileListView()
{
Dispose();
}
public void SetDataContext(object context)
{
treeGrid.DataContext = context;
treeView.Loaded += (sender, e) =>
{
// return when empty
if (treeView.Items.Count == 0)
return;
// return when there are more than one root nodes
if (treeView.Items.Count > 1)
return;
var root = (TreeViewItem) treeView.ItemContainerGenerator.ContainerFromItem(treeView.Items[0]);
if (root == null)
return;
root.IsExpanded = true;
};
}
}
}