Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert XAML to code and vice-versa?
Message
From
08/02/2011 23:31:11
 
 
To
04/02/2011 14:51:21
Guy Pardoe
Pardoe Development Corporation
Peterborough, New Hampshire, United States
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Miscellaneous
Thread ID:
01498821
Message ID:
01499313
Views:
58
>Hi,
>
>Does Visual Studio 2010 have a way to convert some existing XAML into C# code? I want to do a few [XAML-related] things via code so that I can make changes at run-time depending upon user privileges. I figure I might save some time writing code if I could just automatically convert the existing XAML into a code snippet.
>
>Any ideas?
>
>Thanks,
>Guy

I haven't seen one, and since not all XAML can be properly represented in code I'm not sure you will find one. (Most can, but not all)

You also loose the ability to use a designer and tend to complicate things when you move stuff to code behind. I generally restrict code behind view creation to things that cannot be done in XAML. Which is actually pretty rare.

You might want to check out ContentTemplateSelectors I think that's what you will want for this. (But that's just a guess without seeing your XAML)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform