I don't know why the DataTrigger only works when the control is visible, What I'm doing something wrong?
Trigger on Visibility True
<StackLayout
x:Name="StackLayoutForm"
IsVisible="{Binding IsFormVisible}">
<Label Text="Name" />
<Entry
x:Name="EntryName"
Text="Foo">
<Entry.Triggers>
<DataTrigger
Binding="{Binding IsFormVisible}"
TargetType="Entry"
Value="True">
<Setter Property="Text" Value="" />
</DataTrigger>
</Entry.Triggers>
</Entry>
</StackLayout>
Trigger on Visibility False
<StackLayout
x:Name="StackLayoutForm"
IsVisible="{Binding IsFormVisible}">
<Label Text="Name" />
<Entry
x:Name="EntryName"
Text="Foo">
<Entry.Triggers>
<DataTrigger
Binding="{Binding IsFormVisible}"
TargetType="Entry"
Value="False">
<Setter Property="Text" Value="" />
</DataTrigger>
</Entry.Triggers>
</Entry>
</StackLayout>
Output
IsFormVisible == true
EntryName.Text == ""
IsFormVisible == false
EntryName.Text == "Foo"
I hope someone can help me.