0

Здравствуйте.

Есть Popup в нем есть кнопки - как изменить цвет кнопки в popup при наведении мыши?

<Popup x:Name="popup" PlacementTarget="{Binding ElementName=btn}">
    <Border>
        <StackPanel>
            <Button>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Margin="2" VerticalAlignment="Center">Текст 1</TextBlock>
                </StackPanel>
            </Button>
            <Button>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Margin="2" VerticalAlignment="Center">Текст 2</TextBlock>
                </StackPanel>
            </Button>
            <Button>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Margin="2" VerticalAlignment="Center">Текст 3</TextBlock>
                </StackPanel>
            </Button>
        </StackPanel>
    </Border>
</Popup>

1 ответ 1

2
    <Button.Style>
        <Style TargetType="Button">
            <Setter Property="Background" Value="Green"/>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="Red"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Button.Style>
1
  • Это не тот эффект, который нужен. Цвет меняется только у кнопки, а в popup - нет. Нужно что-то типа свойства IsHighlighted, как в MenuItem, но только у Button задать. Как это можно сделать?
    – Demon
    27 фев 2012 в 12:16

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.