>This should do:

>http://stackoverflow.com/questions/7796700/changing-button-image-when-isena
bled 

 

I jiggled the XAML around into what I thought might work based on that
discussion (see below), but I get this error:

 

XamlParseException "Triggers collection members must be of type
EventTrigger." I just can't find the right syntax.

 

Greg

 

<StackPanel Orientation="Horizontal" DockPanel.Dock="Right" Margin="4"
VerticalAlignment="Center" >

    <Image x:Name="imgSave" Width="28" Margin="0,0,6,0"
Source="pack://application:,,,/SBD.JobTalk.SDK;Component/resources/Clean.png
">

    </Image>

    <Button x:Name="btnSave" ToolTip="Save the data" Content="Save"
Padding="8,3,8,3" Margin="0,0,0,0" Click="btnSave_Click"

            IsEnabled="{Binding AllowSave,RelativeSource={RelativeSource
FindAncestor, AncestorType={x:Type UserControl}}}">

        <Button.Triggers>

            <Trigger Property="Button.IsEnabled" Value="true">

                <Setter Property="Image.Source"
Value="pack://application:,,,/SBD.JobTalk.SDK;Component/resources/Dirty.png"
TargetName="imgSave"/>

            </Trigger>

            <Trigger Property="Button.IsEnabled" Value="false">

                <Setter Property="Image.Source"
Value="pack://application:,,,/SBD.JobTalk.SDK;Component/resources/Clean.png"
TargetName="imgSave"/>

            </Trigger>

        </Button.Triggers>

    </Button>

</StackPanel>

 

 

Reply via email to