Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert XAML to code and vice-versa?
Message
De
08/02/2011 23:31:11
 
 
À
04/02/2011 14:51:21
Guy Pardoe
Pardoe Development Corporation
Peterborough, New Hampshire, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Divers
Thread ID:
01498821
Message ID:
01499313
Vues:
59
>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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform