Changes

XAML Basics

11 bytes added, 09:10, 28 April 2020
/* Binding options */
</source> <br>
* '''On a MetaProperty -> Attribute =”{Binding Values [Name of MetaProperty]}”'''
<source lang = "xml">
Text=”{Binding Values[MP_SCOPECHANGE]}”
This is a special Binding option, and as above mentioned, you can’t use any of the Modes with it. With this Binding you are restricted to just being able to read this property. When changing a value in the client it won’t arrive to the database. <br> <br>
* '''On a MetaProperty with an additional UBIK Property -> Attribute = ” {Binding PropertyItems [Name of MetaProperty].DisplayValue}”'''
<source lang = "xml">
Text=”{Binding PropertyItems[MP_SCOPECHANGE].DisplayValue}”
This Binding has the additional aspect that, with the second kind of the UBIK property, values can be saved back to the database but ONLY when you add a command to the object where your Binding is placed. When talking about a UBIK property, we mean properties from an UBIK ViewModel, which is the same as a simple property on a ViewModel in the end. The only difference is that they have certain limitations, as for example not all of the modes are available for all UBIK properties.<br> <br>
* '''On an element in your XAML code -> Attribute = “{Binding attribute, ElementName= x:Name}”'''
<source lang="xml">
Background=”{Binding Background, ElementName=ValueBall}”
</source>
This Binding can be very practical, if you want ‘copy’ their value of an attribute or switch e.g. the Visibility of an element by making it dependent of the attribute value on a different element. There are various possibilities in how to bind to an ElementName. Also, the usage of a converter and a parameter is possible, which often comes handy.<br>
** '''Using a converter and an additonal parameter could look like this -> Attribute = “{Binding ElementName=element, Path=attribute, Converter={StaticResource converter}}”'''
<source lang="xml">
<!--With a converter-->
</source> <br> <br>
* '''Binding a command to an Interactivity -> Command ="{Binding CustomCommand}"''' <br>
Bindings are also used to bind custom commands to a command element. In this example we have even two commands bound to:
<source lang="xml">