Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please can someone tell me how to paste xaml code in articles on CodeProject.

<pre lang="......
Posted

As XAML is XML, you need to use lang="XML". The only problem is how to show XML in HTML. Look at this solution using "Improve solution" (please don't commit!) or your browser's "View Page Source". You will get the idea.

If you write the code:

XML
<pre lang="XML">
&lt;Window x:Class=&quot;WpfApplication1.MainWindow&quot;
        xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
        xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
        Title=&quot;MainWindow&quot; Height=&quot;350&quot; Width=&quot;525&quot;&gt;
&lt;!-- ... --&gt;
&lt;/Window&gt;
</pre>


It will render as:
XML
<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
<!-- ... -->
</Window>


—SA
 
Share this answer
 
v2
Comments
Espen Harlinn 16-Aug-11 13:25pm    
Right, my 5
Sergey Alexandrovich Kryukov 16-Aug-11 14:40pm    
Thank you, Espen.
--SA
fjdiewornncalwe 16-Aug-11 14:48pm    
Nicely done. +5
Sergey Alexandrovich Kryukov 16-Aug-11 16:29pm    
Thank you, Marcus.
--SA
Oludayo Alli 17-Aug-11 0:22am    
Thanks, I know XAML is XMl but rendering it in HTML was what I needed most & I've gotten it. Keep up the good work!
Paste you code and then choose code block (if you are using an HTML5 compliant browser).
Example as below -
<textblock>Xaml here</textblock>
 
Share this answer
 
v2
<pre lang="XML">
add your XAML here
</pre>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900