The problem is that dependency property values โโset locally (for example, you did with visibility) have a higher priority than those set from a style trigger. Thus, even when the trigger fires, it does not cancel the value that you have already set.
A simple solution is to set the default value in Setter style instead:
<Button Name="myBtn" Content="Hello"> <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Visibility" Value="Hidden"/> <Style.Triggers> <DataTrigger Binding="{Binding ElementName=comboBox, Path=SelectedIndex}" Value="1"> <Setter Property="Visibility" Value="Visible"/> </DataTrigger> </Style.Triggers> </Style> </Button.Style> </Button>
And now your trigger will override the value of the property when it hits.
While you are on it, you should take a look at this link , which indicates the priority order for setting DP values.
dlev source share