Skip to content

Commit 17781c2

Browse files
committed
Fix a NullReferenceException in ExplorerBrowser by adjusting the order or static readonly fields.
1 parent 5f00f7c commit 17781c2

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

source/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,24 @@ namespace Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation
1313
/// <summary>Interaction logic for ExplorerBrowser.xaml</summary>
1414
public partial class ExplorerBrowser : UserControl, IDisposable
1515
{
16+
private static readonly DependencyPropertyKey ItemsPropertyKey =
17+
DependencyProperty.RegisterReadOnly(
18+
"Items", typeof(ObservableCollection<ShellObject>),
19+
typeof(ExplorerBrowser),
20+
new PropertyMetadata(null));
21+
22+
private static readonly DependencyPropertyKey NavigationLogPropertyKey =
23+
DependencyProperty.RegisterReadOnly(
24+
"NavigationLog", typeof(ObservableCollection<ShellObject>),
25+
typeof(ExplorerBrowser),
26+
new PropertyMetadata(null));
27+
28+
private static readonly DependencyPropertyKey SelectedItemsPropertyKey =
29+
DependencyProperty.RegisterReadOnly(
30+
"SelectedItems", typeof(ObservableCollection<ShellObject>),
31+
typeof(ExplorerBrowser),
32+
new PropertyMetadata(null));
33+
1634
/// <summary>The items in the ExplorerBrowser window</summary>
1735
public static readonly DependencyProperty ItemsProperty = ItemsPropertyKey.DependencyProperty;
1836

@@ -185,24 +203,6 @@ public partial class ExplorerBrowser : UserControl, IDisposable
185203
typeof(ExplorerBrowser),
186204
new PropertyMetadata(ExplorerBrowserViewMode.Auto, OnViewModeChanged));
187205

188-
private static readonly DependencyPropertyKey ItemsPropertyKey =
189-
DependencyProperty.RegisterReadOnly(
190-
"Items", typeof(ObservableCollection<ShellObject>),
191-
typeof(ExplorerBrowser),
192-
new PropertyMetadata(null));
193-
194-
private static readonly DependencyPropertyKey NavigationLogPropertyKey =
195-
DependencyProperty.RegisterReadOnly(
196-
"NavigationLog", typeof(ObservableCollection<ShellObject>),
197-
typeof(ExplorerBrowser),
198-
new PropertyMetadata(null));
199-
200-
private static readonly DependencyPropertyKey SelectedItemsPropertyKey =
201-
DependencyProperty.RegisterReadOnly(
202-
"SelectedItems", typeof(ObservableCollection<ShellObject>),
203-
typeof(ExplorerBrowser),
204-
new PropertyMetadata(null));
205-
206206
private readonly DispatcherTimer dtCLRUpdater = new DispatcherTimer();
207207

208208
private readonly ObservableCollection<ShellObject> items;

0 commit comments

Comments
 (0)