WPF trigger problem

  • Thread starter Thread starter Dmitry Nogin
  • Start date Start date
D

Dmitry Nogin

Hi,

I have the following markup (Slider and Button):

<StackPanel Margin="10">
<Slider Name="slider" Minimum="0" Maximum="10" Value="0"/>
<Button Name="btn" Content="5">
<Button.Style>
<Style>
<Style.Triggers>
<Trigger Property="Button.IsPressed" Value="True">
<Setter TargetName="slider" Property="Value"
Value="5"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</StackPanel>

I would like the button to adjust slider position.
But I have the following error message at the Setter's line:

"Value 'Value' cannot be assigned to property 'Property'. Cannot find the
Trigger
target 'slider'. (The target must appear before any Setters, Triggers, or
Conditions that use it.)"

What did I do wrong?


Thanks,
-- dmitry
 
Back
Top