D
D
Denis Mashanov2018-03-07 21:10:49
WPF
Denis Mashanov, 2018-03-07 21:10:49

Why is the trigger not working?

All good evening. The trigger does not work, namely the picture does not change, please help, I cannot understand what it is missing. (

<Button Width="23" VerticalAlignment="Center"
                        HorizontalContentAlignment="Center"
                        Margin="50,1,0,1" HorizontalAlignment="Left" Height="23" Cursor="Hand" Background="{x:Null}">
                    <Button.Template>
                        <ControlTemplate TargetType="Button">
                            <Ellipse>
                                <Ellipse.Fill>
                                    <ImageBrush ImageSource="ico/arrowL.png" />
                                </Ellipse.Fill>
                            </Ellipse>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Ellipse.Fill">
                                        <Setter.Value>
                                            <ImageBrush ImageSource="ico/arrowRR.png" />
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Cursor" Value="Hand" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Button.Template>
                </Button>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Mashanov, 2018-03-08
@LoneRay

<Button Width="23" VerticalAlignment="Center"
                        HorizontalContentAlignment="Center"
                        Margin="51,1,0,1" HorizontalAlignment="Left" Height="23" Cursor="Hand">
                    <Button.Style>
                        <Style TargetType="{x:Type Button}">
                            <Setter Property="Background">
                                <Setter.Value>
                                    <ImageBrush ImageSource="ico/arrowL.png" />
                                </Setter.Value>
                            </Setter>
                            <Style.Triggers>
                                <Trigger Property="IsMouseOver" Value="true">
                                    <Setter Property="Background">
                                        <Setter.Value>
                                            <ImageBrush ImageSource="ico/arrowLM.png" />
                                        </Setter.Value>
                                    </Setter>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="true">
                                    <Setter Property="Background">
                                        <Setter.Value>
                                            <ImageBrush ImageSource="ico/arrowLP.png" />
                                        </Setter.Value>
                                    </Setter>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </Button.Style>
                    <Button.Template>
                        <ControlTemplate TargetType="Button">
                            <Ellipse Fill="{TemplateBinding Background}" />
                        </ControlTemplate>
                    </Button.Template>
                </Button>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question