Changes
'''Converters''' are used to prepare application data to format a UI defined by a XAML markup. These converters make it possible to show elements only when specific conditions (like data being available) are met. This allows the creation of a good UI with XAML code only, improving code readability while also decreasing code complexity.
This page explains how to properly use converters for customizing the UBIK Xamarin Mobile User Interface. Furthermore, all available converters are listed to provide a good reference.
= Definition =
In XamarinMobile clients, before converters can be used, they need to be defined in the page's ''Resources'' tag. Make sure to include the <code>UBIK.CPL.Converters</code> namespace in the namespace definitions!
The following example shows how the <code>NullToBoolConverter</code> can be defined:
<syntaxhighlight lang="xml">
Mobile(Xamarin):
<ContentView x:Class="UBIK.CPL.Resources.UBIKChildArea"
xmlns="http://xamarin.com/schemas/2014/forms"
In the following example, which is the same example from above, the '''StringFormatConverter''' will be additionally defined. To add more formatting possibilities, it has two extra properties, which need to be prefilled during initialization. Henceforth, these properties can be prefilled with static values or with static references.
<syntaxhighlight lang="xml">
Mobile(Xamarin):
<ContentView x:Class="UBIK.CPL.Resources.UBIKChildArea"
xmlns="http://xamarin.com/schemas/2014/forms"
The usage is pretty simple: Similar to the converters, it needs to be defined in the '''Page Resources'''. Then, a '''Key''' and '''Expression''', as well as an '''ItemsSource''' have to be defined. Last, but not least, the the converter can be used within the '''ItemsSource''' property of a Syncfusion '''SfListView'''. See the following example:
<syntaxhighlight lang="xml">
Mobile(Xamarin):
<ContentView x:Class="UBIK.CPL.Resources.UBIKChildArea"
xmlns="http://xamarin.com/schemas/2014/forms"
= List of Available Converters =
The following list contains all currently available converters for UBIK Xamarin Mobile customizing.
'''Two-way''' converters can be used with two-way bindings, e.g. a text-box displaying an editable value. If the value updates in the model, the text-box text changes. If the user edits the value, the value in the model behind also gets updated.
[[Category:Client|Converters In Xamarin]]
[[Category:Mobile|Converters In Xamarin]]
[[Category:XAML|Converters In Xamarin]]
