Print Page | Close Window

Border Style Trigger

Printed From: Codejock Forums
Category: General
Forum Name: XAML Snippets
Forum Description: Post your XAML snippets here for everyone to enjoy :)
URL: http://forum.codejock.com/forum_posts.asp?TID=15527
Printed Date: 26 April 2024 at 4:45pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Border Style Trigger
Posted By: zitz
Subject: Border Style Trigger
Date Posted: 02 November 2009 at 7:48am
Why do not change the border parameter 'BorderThickness' when mouse is over?
How can I fix this?

Copy this code to MarkupPad.exe to show the problem:

<Page xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
    <StackPanel TextElement.FontSize='20' Orientation='Horizontal' HorizontalAlignment='Center'>
        <TextBlock VerticalAlignment='Center'>
            <Hyperlink Tag='tag' TextDecorations=''>
                <Border Padding='0' BorderThickness='0' BorderBrush='#000080' CornerRadius='3'>
                    <Border.Style>
                        <Style TargetType='Border'>
                            <Style.Triggers>
                                <Trigger Property='IsMouseOver' Value='True'>
                                    <Trigger.Setters>
                                        <Setter Property='Background' Value='#ffecbf'/>
                                        <Setter Property='BorderThickness' Value='1'/>
                                    </Trigger.Setters>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </Border.Style>
                    <Image Source="file://d://1.png"/>
                </Border>
            </Hyperlink>
        </TextBlock>
    </StackPanel>
</Page>



-------------
Xtreme ToolkitPro v13.1.0, static, VC++6



Replies:
Posted By: Oleg
Date Posted: 02 November 2009 at 8:11am
Hi,
 
Just remove "BorderThickness='0'" - it overrides one you have in trigger.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: zitz
Date Posted: 02 November 2009 at 8:49am
Works! Magic!!!!
Thank You!

-------------
Xtreme ToolkitPro v13.1.0, static, VC++6


Posted By: Krog
Date Posted: 04 November 2009 at 9:34pm
And if we want the contrary?

Case a: default BorderThickness=1, mouseover BorderThickness=0

Case b: default BorderThickness=2, mouseover BorderThickness=1

How can we do it?


-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2
Language: Visual Basic 6 SP6


Posted By: zitz
Date Posted: 05 November 2009 at 12:38am

    CString sButtonFormat = _T("<TextBlock Margin='0'>")
                            _T(" <Hyperlink Tag='%s' ToolTip='%s' TextDecorations='' Foreground='Gray'>")
                            _T("  <Border Padding='0' BorderBrush='#000080' CornerRadius='3'>")
                            _T("   <Border.Style>")
                            _T("    <Style TargetType='Border'>")
                            _T("     <Setter Property='Margin' Value='1'/>")
                            _T("     <Setter Property='BorderThickness' Value='0'/>")
                            _T("     <Style.Triggers>")
                            _T("      <Trigger Property='IsMouseOver' Value='True'>")
                            _T("       <Trigger.Setters>")
                            _T("        <Setter Property='Background' Value='#ffecbf'/>")
                            _T("        <Setter Property='BorderThickness' Value='1'/>")
                            _T("        <Setter Property='Margin' Value='0'/>")
                            _T("       </Trigger.Setters>")
                            _T("      </Trigger>")
                            _T("     </Style.Triggers>")
                            _T("    </Style>")
                            _T("   </Border.Style>")
                            _T("   <StackPanel Margin='2' Orientation='Horizontal'>")
                            _T("    <TextBlock VerticalAlignment='Center' Text='%s'/>")
                            _T("    <Image Margin='%d, 0, %d, 0' Source='%d'/>")
                            _T("    <TextBlock VerticalAlignment='Center' Text='%s'/>")
                            _T("   </StackPanel>")
                            _T("  </Border>")
                            _T(" </Hyperlink>")
                            _T("</TextBlock>");



-------------
Xtreme ToolkitPro v13.1.0, static, VC++6


Posted By: Oleg
Date Posted: 05 November 2009 at 12:53am
Hi,
 
Yes, right, <Setter Property='BorderThickness' Value='DefaultValue'/>  have to be used then.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net