Add Setter Target Property
See original GitHub issueIs your feature request related to a problem? Please describe. Change the ownership of another element when the selector is activated.
Describe the solution you’d like Considering following Xaml
<StackPanel>
<CheckBox x:Name="Choiche1" Content="Quatsion ?"/>
<TextBox x:Name="Input"/>
<ComboBox x:Name="List"/>
</StackPanel>
I’d like to write selector like this:
<Style Selector="CheckBox#Choiche1[IsChecked=False]">
<Setter Target="Input" Property="IsEnabale" Value="False"/>
<Setter Target="List" Property="IsEnabale" Value="True"/>
</Style>
<Style Selector="CheckBox#Choiche1[IsChecked=True]">
<Setter Property="Backgroud" Value="Green"/>
<Setter Target="Input" Property="IsEnabale" Value="True"/>
<Setter Target="List" Property="IsEnabale" Value="False"/>
</Style>
Describe alternatives you’ve considered I know, I can do a similar thing with binding. But the advantage of the proposed solution is to have everything centralized.
Additional context WPF Setter.TargetName UWP Setter.Target
Issue Analytics
- State:
- Created 4 months ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Setter.TargetName Property (System.Windows)
You can set this property to the name of any element within the scope of where the setter collection (the collection that this...
Read more >TargetName property cannot be set on a Style Setter, so ...
Well it turns out that you can't set Storyboard.TargetName in a Style.Setter because it's a style and is abstracted. Hence a reference via ......
Read more >Getters and Setters: Manage Attributes in Python
Typically, getter methods return the target attribute's value, while setter methods take a new value and assign it to the underlying ...
Read more >Properties | Kotlin Documentation
You can define custom accessors for a property. If you define a custom getter, it will be called every time you access the...
Read more >set - JavaScript - MDN Web Docs - Mozilla
In JavaScript, a setter can be used to execute a function whenever a specified property is attempted to be changed. Setters are most...
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 FreeTop 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
Top GitHub Comments
I disagree. For the most part, yes, nested styles helped out here a lot but Selectors are still kinda verbose
This example from CheckBox could be condensed down to (following UWP’s Target)
Yes I like this solution since it will also simplify setters in styles