Click here to Skip to main content
15,904,415 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I am generating the xaml code Like below Using My Code Generation Tool.
Is there any way to show the preview of generated xaml code in RunTime..

C#
 StringBuilder sb = new StringBuilder();
                          sb.Append("<navigation:baseclass x:class="\""" strnamespace="" strfilename="" tablename="\""" txtrulesetname.text="" name="\""" keydown="\""" modulename="\"Vajra.KhaniPro."" xmlns="\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n" xmlns:x="\"http://schemas.microsoft.com/winfx/2006/xaml\"\n" xmlns:mc="\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n");<br" mode="hold" xmlns:navigation="#unknown" />
               sb.Append("<canvas grid.row="\"1\"" height="\"60\"">\n<Button Name=\"btnNew\"  Width=\"70\"  Content=\"New\"  Grid.Row=\"1\"  Margin=\"28,18\" Click=\"btnNew_Click\" HorizontalAlignment=\"Left\" VerticalAlignment=\"Top\"  />\n");
                sb.Append("<Button Name=\"btnView\"  Width=\"70\"  Content=\"View\" Grid.Row=\"1\" Margin=\"105,18\" Click=\"btnView_Click\" HorizontalAlignment=\"Left\" VerticalAlignment=\"Top\" />\n");
                sb.Append("<Button Name=\"btnEdit\"  Width=\"70\"  Content=\"Edit\" Grid.Row=\"1\" Margin=\"183,18\" Click=\"btnEdit_Click\" HorizontalAlignment=\"Left\" VerticalAlignment=\"Top\" />\n");
                



Sri Manthena</canvas>
Posted
Updated 16-Aug-12 19:23pm
v2
Comments
Sergey Alexandrovich Kryukov 17-Aug-12 1:29am    
Huh?

 
Share this answer
 
Comments
srikanth MAnthena 17-Aug-12 1:38am    
Is it Possible to Display Xaml file Design in Run Time?
Kenneth Haugland 17-Aug-12 1:42am    
XML will only show you the outline of the file, as XAML has the same build up as XML files. However Microsoft has an XAML editor for free:
http://msdn.microsoft.com/en-us/library/ms742398%28v=vs.90%29.aspx
Wendelius 23-Aug-12 12:20pm    
Good link!
OK. "Dynamically run". XAML does not present an imperative programming language (http://en.wikipedia.org/wiki/Programming_language[^]), it cannot be "run" in some universally predefined sense. The XAML artifact per se does not define any algorithm or a scenario of execution of anything.

This is a declarative language used to define some aspects of UI, such as layout and behavior, but it does not always define it fully. It can be used for different purposes, such as a container of some resources and even as a format of vector graphics. Please see:
http://en.wikipedia.org/wiki/XAML[^].

If you mean something else, please explain.

—SA
 
Share this answer
 
Comments
Espen Harlinn 17-Aug-12 5:59am    
Good points :-D
Sergey Alexandrovich Kryukov 17-Aug-12 10:21am    
Thank you, Espen.
--SA
I.explore.code 17-Aug-12 6:05am    
"universally predefined sense"... love it :)
Sergey Alexandrovich Kryukov 17-Aug-12 10:21am    
I though it was a clumsy expression, but thank you very much. :-)
--SA
You are probably looking for something like this:
Editing Examiner Demo[^]

Best regards
Espen Harlinn
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 18-Aug-12 12:48pm    
Useful for understanding how things work. My 5.
--SA
Espen Harlinn 18-Aug-12 12:50pm    
Yes, it works along the lines of xamlpad ;)
Wendelius 23-Aug-12 12:20pm    
Nice link!
Espen Harlinn 23-Aug-12 12:22pm    
Thanks Mika, it's a nice starter application :-D

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