John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Catégorie:
Windows Presentation Foundation (WPF)
>>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 ...
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement