WPF Trigger on template item for a button - Stack Overflow

I would like to change the Line color during IsMouseOver event:<Style x:Key="UiButtonNoTextEdit

I would like to change the Line color during IsMouseOver event:

    <Style x:Key="UiButtonNoTextEdit" BasedOn="{StaticResource UiButtonNoText}" TargetType="{x:Type Button}">
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Border BorderBrush="{StaticResource Br_Azzurro_01}" BorderThickness="1.8" CornerRadius="2" Style="{StaticResource UiButtonBorder}">
                        <StackPanel Orientation="Vertical">
                            <Viewbox UseLayoutRounding="False" Width="30" Height="30" VerticalAlignment="Top" Margin="0,5,0,0">
                                <Canvas ClipToBounds="True" Width="30" Height="30" >
                                    <Path Name="btnPath" Fill="{StaticResource Br_Azzurro_01}" Data="{StaticResource BtnDelete}" Stretch="Fill" Width="30" Height="30"/>
                                </Canvas>
                            </Viewbox>
                            <Line x:Name="line" X1="6" X2="44" StrokeStartLineCap="Round" StrokeEndLineCap="Round" HorizontalAlignment="Stretch" Margin="2,9,3,3" Stroke="{StaticResource Br_Blu_00}" StrokeThickness="4"/>
                        </StackPanel>
                    </Border>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Basically I can't reach the "line" element with my trigger

<Style x:Key="UiButtonBorder" TargetType="{x:Type Border}">
    <Style.Triggers>
        <Trigger Property="Button.IsMouseOver" Value="False">
            <Setter Property="Button.Foreground" Value="{StaticResource Br_Azzurro_02}" />
            <Setter Property="Border.Background" Value="{StaticResource UiButtonGradient}" />
        </Trigger>
        <Trigger Property="Button.IsMouseOver" Value="True">
            <Setter Property="Button.Foreground" Value="{StaticResource Br_Azzurro_02}" />
            <Setter Property="Border.Background" Value="{StaticResource UiButtonGradientOver}" />
        </Trigger>
    </Style.Triggers>
</Style>

I've been able to apply the trigger on Line element but the IsMouseOver on button is what I would.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744920948a4601127.html

相关推荐

  • WPF Trigger on template item for a button - Stack Overflow

    I would like to change the Line color during IsMouseOver event:<Style x:Key="UiButtonNoTextEdit

    1天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信