From 4d8c70b69764e0d7a59a38e3a2b6c86bcb00eb41 Mon Sep 17 00:00:00 2001 From: Qiao Wang Date: Fri, 23 Dec 2022 22:23:17 +0800 Subject: [PATCH] Add null check for ListDetailsView.OnListPaneWidthChanged --- .../SamplePages/ListDetailsView/ListDetailsView.bind | 3 ++- .../ListDetailsView/ListDetailsView.cs | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CommunityToolkit.WinUI.SampleApp/SamplePages/ListDetailsView/ListDetailsView.bind b/CommunityToolkit.WinUI.SampleApp/SamplePages/ListDetailsView/ListDetailsView.bind index cdba10a6635..f51ad67935e 100644 --- a/CommunityToolkit.WinUI.SampleApp/SamplePages/ListDetailsView/ListDetailsView.bind +++ b/CommunityToolkit.WinUI.SampleApp/SamplePages/ListDetailsView/ListDetailsView.bind @@ -11,7 +11,8 @@ + CompactModeThresholdWidth="720" + ListPaneWidth="400"> diff --git a/CommunityToolkit.WinUI.UI.Controls.Layout/ListDetailsView/ListDetailsView.cs b/CommunityToolkit.WinUI.UI.Controls.Layout/ListDetailsView/ListDetailsView.cs index 6bfd38c7320..9ac5a35c60f 100644 --- a/CommunityToolkit.WinUI.UI.Controls.Layout/ListDetailsView/ListDetailsView.cs +++ b/CommunityToolkit.WinUI.UI.Controls.Layout/ListDetailsView/ListDetailsView.cs @@ -469,7 +469,10 @@ protected override void OnItemsChanged(object e) /// private void OnListPaneWidthChanged() { - _twoPaneView.Pane1Length = new GridLength(ListPaneWidth); + if (_twoPaneView != null) + { + _twoPaneView.Pane1Length = new GridLength(ListPaneWidth); + } } } }