Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert XAML to code and vice-versa?
Message
From
09/02/2011 07:17:08
John Baird
Coatesville, Pennsylvania, United States
 
 
To
08/02/2011 23:31:11
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Miscellaneous
Thread ID:
01498821
Message ID:
01499333
Views:
60
>>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)

I agree... Content selectors are probably the way to go ...
Previous
Reply
Map
View

Click here to load this message in the networking platform