Codejock Forums Homepage
Forum Home Forum Home > General > XAML Snippets
  New Posts New Posts RSS Feed - Border Style Trigger
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Border Style Trigger

 Post Reply Post Reply
Author
Message
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Topic: Border Style Trigger
    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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Posted: 02 November 2009 at 8:49am
Works! Magic!!!!
Thank You!
Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
Krog View Drop Down
Groupie
Groupie


Joined: 06 February 2008
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote Krog Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.