Open
Description
Example code is sometimes separated into 2 blocks, although could be displayed in the single block. This applies to multiple articles and multiple code languages. The publishing system can't merge two snippets into a single presented snippet block in the published article. The original authors tried to reuse portions of code which required them to use more than one code block, one after the other. Frankly, it looks terrible.
This issue is to track which articles have this problem and serve as a jumping off point for contributors to identify where to fix the issue.
Articles that need fixes:
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
adegeo commentedon Sep 22, 2020
Thank you for reporting this.
This is a common issue throughout the WPF documentation. Various parts of the XAML are reused and split out. We've recently adopted a model where we're just going to duplicate the XAML for each article instead of trying to reuse them as it causes problems like this.
kosist commentedon Sep 24, 2020
Interesting that when I open page for editing on github, it has links to the code which are broken (or there is no access to them):

Is it possible to access them in order to make a fix by myself; or you have it somehow protected internally?
adegeo commentedon Sep 24, 2020
Thanks for the desire to contribute 👍
This is a actually a bit more complicated. First, a lot of the links don't work via github because of the syntax used. The
#Source
link for example defines this in the source:~/samples/snippets/csharp/VS_Snippets_Wpf/CollectionBinding/CSharp/Window1.xaml#source
with the~
(to indicate the root) being the problem. To view the file in github you would need to adjust the URL in your browser (here is the link):Snippet blocks are indicated with an XML comment containing an xml node (named of the snippet you want to define) that is open or closed open/close to indicate the snippet area. (if no # is used in the snippet reference in the doc, the whole file is presented on the published article)
So you can see the
#source
snippet being defined here:The publishing system can't merge two snippets into a single presented snippet block in the published article. This is why it ends up being two distinct blocks and frankly looks terrible. The reason it's being displayed this way is that the source file contains a datatemplate that is being omitted in this reference because it's talked about in the next section of the article.
Really this XAML needs to be duplicated into two files, one to present the datatemplate and another to present the Source/UI snippets as a single one.
kosist commentedon Oct 6, 2020
Thank you for the detailed explanation!
adegeo commentedon Oct 12, 2020
I think we should turn this into a project issue which is to identify and fix all of the individual articles that have this problem. I'm going to edit it to remove the metadata and then add links to each file identified via issues.
[-]Example XAML code is separated into 2 blocks[/-][+]Example code blocks are sometimes separated into 2 or more blocks[/+]16 remaining items