Skip to content

Commit 220426e

Browse files
authored
Fix sample presenter not properly determing if its empty (microsoft#1374)
<!--- Provide a general summary of your changes in the Title above --> ## Description <!--- Describe your changes in detail --> The sample presenter did not properly determine if it was empty resulting in it not hiding despite it being empty. ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here. --> Fixes microsoft#1373 ## How Has This Been Tested? <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## Screenshots (if appropriate): ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change)
1 parent b78b8a5 commit 220426e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

WinUIGallery/Controls/SampleCodePresenter.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public IList<ControlExampleSubstitution> Substitutions
6767
set { SetValue(SubstitutionsProperty, value); }
6868
}
6969

70-
public bool IsEmpty => Code.Length == 0 && CodeSourceFile == null;
70+
public bool IsEmpty => string.IsNullOrEmpty(Code) && string.IsNullOrEmpty(CodeSourceFile);
7171

7272
private string actualCode = "";
7373
private static Regex SubstitutionPattern = new Regex(@"\$\(([^\)]+)\)");
@@ -88,7 +88,7 @@ private static void OnDependencyPropertyChanged(DependencyObject target, Depende
8888

8989
private void ReevaluateVisibility()
9090
{
91-
if (Code.Length == 0 && CodeSourceFile == null)
91+
if (IsEmpty)
9292
{
9393
Visibility = Visibility.Collapsed;
9494
}

0 commit comments

Comments
 (0)