Skip to content

Commit c206d44

Browse files
Ensure presenter visibility in sample rendering (#2050)
<!--- Provide a general summary of your changes in the Title above --> ## Description <!--- Describe your changes in detail --> This PR ensures that the code presenter inside the `SampleCodePrenseter` custom control is visible whenever it has code to render. ## 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 #2049. ## 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. --> Manually tested. ## 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) Co-authored-by: Niels Laute <[email protected]>
1 parent 9de3851 commit c206d44

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

WinUIGallery/Controls/SampleCodePresenter.xaml.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ private async void FormatAndRenderSampleFromFile(string sourceRelativePath, Cont
194194

195195
private void FormatAndRenderSampleFromString(string sampleString, ContentPresenter presenter, ILanguage highlightLanguage)
196196
{
197+
// Make sure the presenter is visible in case it was collapsed due to no code being present.
198+
presenter.Visibility = Visibility.Visible;
199+
197200
// Trim out stray blank lines at start and end.
198201
sampleString = sampleString.TrimStart('\n').TrimEnd();
199202

0 commit comments

Comments
 (0)