Changes

XAML Tips

1,380 bytes added, 09:06, 19 September 2019
</source>
=== MultiBinding {{Version/WinXSince|3.6}} ===
Very often we want to display some UI elements (e.g. a Grid) depending on whether multiple criteria are met. It's much easier to achieve this by using a MultiBindingBehavior like the following.
<source lang = "xml">
<DataTemplate
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:cimalinoBehaviors="using:Cimbalino.Toolkit.Behaviors">
...
<Grid>
<Interactivity:Interaction.Behaviors>
<cimalinoBehaviors:MultiBindingBehavior Converter="{StaticResource VisLogicAndConverter}" PropertyName="Visibility">
<cimalinoBehaviors:MultiBindingItem Value="{Binding MassEditViewModel, Converter={StaticResource NullToVisConverter}}" />
<cimalinoBehaviors:MultiBindingItem Value="{Binding Documents.Items.Count, Converter={StaticResource ItemCountToVisConverter}}" />
</cimalinoBehaviors:MultiBindingBehavior>
</Interactivity:Interaction.Behaviors>
</Grid>
</DataTemplate>
</source>
The behavior makes sure the container Grid is set to Visibile only if the mass editing mode is not turned on (MassEditViewModel is null) and the context object has child document(s) (Documents.Items.Count is greater than 0. You can combine any number of binding results (MultiBindingItem) using the VisLogicAndConverter (the name should be self explanatory).
== Performance related ==