Skip to content

DataTemplateSelectors

Håvard Moås edited this page Jun 4, 2020 · 3 revisions

Data template selectors can be used by different view elements. We have provided a couple of built in templates that is useful. A very common and well used pattern is to use it with a ContentControl.

👉 To get started, make sure you have followed the getting started steps

BooleanDataTemplateSelector

Namespace: DIPS.Xamarin.UI.Content.DataTemplateSelectors

This selector lets you select a DataTemplate based on an boolean item.

Example:

<dxui:ContentControl SelectorItem="{Binding BooleanProperty}"
                     TemplateSelector="{dxui:BooleanDataTemplateSelector 
                                        TrueTemplate={StaticResource TrueTemplate},
                                        FalseTemplate={StaticResource FalseTemplate}}" />

This will select select TrueTemplate / FalseTemplate depending on the boolean value. This will result in the content of the ContentControl change according to the BooleanProperty.

Clone this wiki locally