Changes
</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).
=== InvokeForAllItemsCommand {{Version/WinXSince|3.6}} ===
Available on all ListViewModels, this command allows executing a specified command on a collection of list items. It can be used in combination with features such as [[Mass_Edit_(UBIK_WinX)|mass editing]] and [[XAML_Changes_in_UBIK_WinX_3.5#After_3.5|expression based collection filtering]]. Examples for both combinations are provided below.
{{Attention|The command specified through the "Command" parameter is executed on list items and, therefore, must be available in the list item contexts (view models). If in doubt, the [[Developer_Mode|developer mode]] can be used to inspect if a command is available in a certain context.}}
==== Invoke on selected items ====
This example demonstrates how you can use the mass editing feature to select certain objects from the child list and then execute the SetPropertyValueAndValidateCommand for those selected.
* The example code assumes that the child objects have an editable property called "VALUE" and tries to set 50 as their value;
* You should insert the following code snippet into the default UBIKChildArea template;
* If the parameter "SelectedItemsOnly" is missed or set to "False", the command will be executed on all child items.
<br />
<source lang = "xml">
<AppBarButton
xmlns:example="using:UBIK.WinX.Controls"
Command="{Binding Children.InvokeForAllItemsCommand}"
Icon="AllApps"
Label="Set to 50%"
Style="{ThemeResource UBIKActionAppBarButton}">
<AppBarButton.CommandParameter>
<example:KeyValueList>
<example:KeyValueParameter Key="Command" Value="SetPropertyValueAndValidateCommand" />
<example:KeyValueParameter Key="SelectedItemsOnly" Value="True" />
<example:KeyValueParameter Key="PropertyName" Value="VALUE" />
<example:KeyValueParameter Key="PropertyValue" Value="50" />
</example:KeyValueList>
</AppBarButton.CommandParameter>
</AppBarButton>
</source>
==== Invoke on filtered results ====
First, you need to setup a filtered list (ListCollectionView) in the Resources section of a UI element (e.g. Grid).
* This list is only available/visible within that UI element (the Grid in this case);
* The ItemsSource uses Children.Items. Use the [[Developer_Mode|developer mode]] if necessary to find out if this is available where you intend to define the list;
* The example expression filters for any items that don't contain the text "EXAMPLE" in their Title texts. You can filter differently by altering the expression.
<br />
<source lang = "xml">
<Grid xmlns:CV="using:UBIK.WinX.UI.CollectionView">
<Grid.Resources>
<CV:ListCollectionView
x:Key="Filtered"
Expression="!Item.Title.Contains("EXAMPLE")"
ItemsSource="{Binding Children.Items}" />
</Grid.Resources>
...
</Grid>
</source>
<br />
With the filtered list configured, you can then insert the following code snippet to execute the SetPropertyValueAndValidateCommand for the filtered result items.
<br />
<source lang = "xml">
<AppBarButton
xmlns:example="using:UBIK.WinX.Controls"
Command="{Binding Source={StaticResource Filtered}, Path=ListViewModel.InvokeForAllItemsCommand}"
Icon="AllApps"
Label="Set to 50"
Style="{ThemeResource UBIKActionAppBarButton}">
<AppBarButton.CommandParameter>
<example:KeyValueList>
<example:KeyValueParameter Key="Command" Value="SetPropertyValueAndValidateCommand" />
<example:KeyValueParameter Key="SelectedItemsOnly" Value="True" />
<example:KeyValueParameter Key="PropertyName" Value="VALUE" />
<example:KeyValueParameter Key="PropertyValue" Value="50" />
</example:KeyValueList>
</AppBarButton.CommandParameter>
</AppBarButton>
</source>