WPF trigger problem

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top