WPF draw Border on MouseOver

Posted by tcables on Stack Overflow See other posts from Stack Overflow or by tcables
Published on 2010-06-15T15:30:40Z Indexed on 2010/06/15 15:32 UTC
Read the original article Hit count: 1102

Filed under:
|
|
|
|

Hello,

I have a WPF Application where I am trying to make a close button like image. I am trying to draw a border or have a border show up on mouse over... But I cannot seem to make it work. I have tried like 6 different methods of doing so...Images, borders with images, brushes, ect.

I am using the following code at the moment:

<Canvas Name="cMin" Height="16" Width="16"
        Grid.Column="1" Grid.Row="1">
    <Canvas.Background>
        <ImageBrush ImageSource="_.png" Stretch="None" />
    </Canvas.Background>
    <Border BorderBrush="Transparent" BorderThickness="1" Background="Transparent" 
            CornerRadius="0" Height="18" Width="18">
         <Border.Style>
            <Style TargetType="Border">
                <Style.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="BorderBrush" Value="LightBlue" />
                    </Trigger>
                    <Trigger Property="IsMouseOver" Value="False">
                        <Setter Property="BorderBrush" Value="Transparent" />
                    </Trigger>
                </Style.Triggers>
            </Style>
        </Border.Style>
    </Border>
</Canvas>

Any help would be appreciated, Thanks!

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf