Changes

Mobile XAML

3,004 bytes added, 9 July
/* Known issues */ Added section on conflicting triggers discovered by CWI in the context of #4454
<br>
<br>
=== DataTrigger Issues ======= Conflicting Triggers ====DataTriggers in Xamarin/Maui function better than the equivalent DataTriggerBehavior in UWP as they automatically handle the opposite case when a Boolean attribute value is set. This means that if a boolean DataTrigger is set, such as IsVisible=True, the False visibility will automatically be set if the Binding/Value condition is not met. However, this means that stacking multiple DataTriggers on the same attribute can lead to unexpected results. For this reason, it is recommended to use as few DataTriggers as possible. * Avoid setting the same attribute more than once; do not set the same value as a default attribute and a DataTrigger (ControlTemplate in the below example).* In certain cases (ie. the UBIKEdit... xamls) the ContentView had no default ControlTemplate, rather two DataTriggers to set either possible template. This led to an issue in Maui where the SelectedItem was not shown when opening the dialog, and should therefore be avoided. <tabs><tab name="Don't Do"><source lang = "xml"><ContentView x:Name="editorValueContainer" ControlTemplate="{StaticResource SelListTemplate}"> <ContentView.Triggers> <DataTrigger Binding="{Binding Source={x:Reference editorValueContainer}, Path=BindingContext.PropertyViewModel.ShowComboBox}" TargetType="ContentView" Value="true"> <Setter Property="ControlTemplate" Value="{StaticResource SelListTemplate}" /> </DataTrigger> <DataTrigger Binding="{Binding Source={x:Reference editorValueContainer}, Path=BindingContext.PropertyViewModel.ShowComboBox}" TargetType="ContentView" Value="false"> <Setter Property="ControlTemplate" Value="{StaticResource TextTemplate}" /> </DataTrigger> </ContentView.Triggers></ContentView></source><br>OR  <source lang = "xml"><ContentView x:Name="editorValueContainer" > <ContentView.Triggers> <DataTrigger Binding="{Binding Source={x:Reference editorValueContainer}, Path=BindingContext.PropertyViewModel.ShowComboBox}" TargetType="ContentView" Value="true"> <Setter Property="ControlTemplate" Value="{StaticResource SelListTemplate}" /> </DataTrigger> <DataTrigger Binding="{Binding Source={x:Reference editorValueContainer}, Path=BindingContext.PropertyViewModel.ShowComboBox}" TargetType="ContentView" Value="false"> <Setter Property="ControlTemplate" Value="{StaticResource TextTemplate}" /> </DataTrigger> </ContentView.Triggers></ContentView></source></tab> <tab name="Instead Do"><source lang = "xml"><ContentView x:Name="editorValueContainer" ControlTemplate="{StaticResource SelListTemplate}"> <ContentView.Triggers> <DataTrigger Binding="{Binding Source={x:Reference editorValueContainer}, Path=BindingContext.PropertyViewModel.ShowComboBox}" TargetType="ContentView" Value="false"> <Setter Property="ControlTemplate" Value="{StaticResource TextTemplate}" /> </DataTrigger> </ContentView.Triggers></ContentView></source></tab></tabs>  ==== DataTrigger to set Footer Properties in a ListView ====
When using a DataTrigger to set the properties of a footer for a ListView, the sequence of the properties inside the DataTrigger might matter in some cases.
696
edits