In this , I'm going to show you how XAML Works in background and makes UI designing very easy for us .
we're going to discuss about Automatic Type converters in XAML.
whenever you make some control in XAML you set its properties. For example in following screen shot we are making a button in XAML and setting its properties like
- Name
- Horizontal Alignment
- Margin
- Background
- Vertical Alignment
- Horizontal Alignment
- and
- So you have limited options as shown in above screenshot. you've to select 1 position from 4 given options . These options are infect enums.
have you ever noticed that when you type in for setting the properties like ,
Now I'm going to show you the alternate way to set properties using C# syntax. To make a button from C# write following code in Page Load Event in program.
when you make a control from C# code. You've to set all of its properties in code. In this case we've set its
- HorizontalAlignment
and - Background
Answer is ! XAML parser does this job.
XAML parser convert string value into a strongly typed version of that value.
so when you set the properties like < horizontalAllignment = "Left" > , the string "Left" will be mapped to the strongly typed enum by the XAML parser.
XAML parser convert string value into a strongly typed version of that value.
so when you set the properties like < horizontalAllignment = "Left" > , the string "Left" will be mapped to the strongly typed enum by the XAML parser.



No comments:
Post a Comment