Using OR to Combine Enumerated Values in XAML

Sometimes, you find that you need to use the OR operator to join together a number of values from an enumeration, and assign the result to a property in XAML. The CommandButtonsVisibility property on the DataForm control is a perfect example of this. As you saw in Chapter 7, this property determines what command buttons should be displayed in the data form by using the OR operator to combine the corresponding values from the DataFormCommandButtonsVisibility enumeration. Whereas you might do the following in code:

ProductsDataForm.CommandButtonsVisibility =
                        DataFormCommandButtonsVisibility.Add |
                        DataFormCommandButtonsVisibility.Delete;

you can achieve the same result in XAML by simply concatenating the value names, separated by commas:

<toolkit:DataForm Name="ProductsDataForm"
                  CommandButtonsVisibility="Add,Delete" />

images Note This works only on control properties that accept a combination of enumeration values. Most control properties tend to accept only a single value from a set of enumerated values.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset