KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a theme that is applied to all buttons in a resource dictionary. Now I want to add a trigger to the button while inheriting the style changes from the dictionary. I tried the following code, but it says that the control cannot be found. How can I fix it ? <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Theme.xaml"/> </ResourceDictionary.MergedDictionaries> <conv:ErrorContentConverter x:Key="ErrorContentConverter" /> <Style x:Key="ValidTrigger" TargetType="Control" BasedOn="{StaticResource {x:Type Control}}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=IsValid}" Value="False"> <Setter Property="IsEnabled" Value="false" /> </DataTrigger> </Style.Triggers> </Style> </ResourceDictionary> </UserControl.Resources> The base template: <Style TargetType="{x:Type Button}" BasedOn="{x:Null}"> <Setter Property="FocusVisualStyle" Value="{DynamicResource NuclearButtonFocusVisual}" /> <Setter Property="Foreground" Value="#FF042271" /> <Setter Property="FontFamily" Value="Trebuchet MS" /> <Setter Property="FontSize" Value="12" /> <Setter Property="Padding" Value="3" /> <Setter Property="Template" Value="{DynamicResource ButtonTemplate}" /> </Style>
Tags (comma-separated)
Save Edits
Cancel