How does the VS XAML designer know what to auto-populate certain values with?
- by Pwninstein
<Button Name="MyButton" Content="Test" FontStyle="Italic" />
In the above XAML definition of a button, the FontStyle property is set to Italic. The designer is somehow able to populate a list for me to choose from when I hit the = sign. How is this achieved?
Before you answer, consider that the FontStyle property is, appropriately enough, of type FontStyle (which is a struct). It's not an enumeration, which would be trivial for VS to list out at design time, so how are the valid list of options chosen to be displayed? There is also a completely separate FontStyles class which contains three static fields, Italic, Normal, and Oblique which just so happen to be the three items VS provides in the drop down list. Is there some mapping going on behind the scenes between the FontStyle struct and FontStyles class, because I've looked in many places in both the object browser and in .NET Reflector and couldn't determine anything from either.
Thanks!!
I NEED to know!*
*Not really, but it would be nice to :)