DataTrigger properties on child controls
See original GitHub issueI would like to be able to change the TextColor of the label in response to the pressed state of the ContentView (similar to the sample here). When TouchEffect was previously a control, I did something like this:
...
<touch:TouchView x:Name="touchView">
<Label>
<Label.Triggers>
<DataTrigger Binding="{Binding Source={x:Reference touchView}, Path=State}" TargetType="Label" Value="Pressed">
<Setter Property="TextColor" Value="Red" />
</DataTrigger>
</Label.Triggers>
</Label>
</touch:TouchView>
Now that it’s an effect, I tried doing something like this but no luck:
<Label.Triggers>
<DataTrigger Binding="{Binding Source={x:Reference ContentViewName}, Path=(touch:TouchEff.State)}" TargetType="Label" Value="Pressed">
<Setter Property="TextColor" Value="Red" />
</DataTrigger>
</Label.Triggers>
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
How would you bind a DataTrigger to a Child property from ...
1 Answer 1 ... This property has no logic, it's just used for "connecting" controls any way you like. ... I wouldn't recommend...
Read more >WPF - How to access child properties in XAML not using ...
I know how to access parent properties to change child properties in XAML. ... Triggers> <DataTrigger Binding="{Binding ...
Read more >DataTrigger Class (System.Windows)
Represents a trigger that applies property values or performs actions when the bound data meets a specified condition.
Read more >WPF Setter Property of named child : r/dotnet
In my WPF application, I have the following Style: <Style TargetType="ListViewItem" x:Key="YouTubeItem"> <Setter Property="Template"> ...
Read more >Wpf – UserControl property trigger for child control
Best Solution. Use a DataTrigger instead of a normal Trigger which is for internal property changes, it has a Binding -Property where you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Then only:
https://stackoverflow.com/questions/42544575/binding-to-attached-properties-in-xamarin-forms
Impossible to bind to attached property