Is there a way to apply a style for all controls of the same type in a user element, one dynamically, without applying to all the controls in my application and without going into the control and setting the style manually
EDIT
The problem is that in my ResorceDictionary I have 2 styles, with a set of x: Key
<Style x:Key="ScrollBar_White" TargetType="{x:Type ScrollBar}">
<Style x:Key="ScrollBar_Black" TargetType="{x:Type ScrollBar}">
And I want to know if there is a way in XAML to apply a dynamically named style without using the following code on all scrollbars of my UserControl.
<ScrollBar Style="ScrollBar_White">
EDIT
Sorry, I'm new to WPF, so I donβt have enough for you to know what is important (what I discovered after applying your last solution). The latter solution really works if the styles are StaticResources, but they are DynamicResources, and BasedOn do not work with DynamicResources.
Any idea how to do this with DynamicResource?
Thank you very much and it is a pity that I missed important questions in my questions.
Paulo source
share