SlideShare a Scribd company logo
1 of 23
Triggers, Actions
& Behaviors

  Eyal Vardi
  CEO E4D Solutions LTD
  Microsoft MVP Visual C#
  blog: www.eVardi.com
Agenda
            Actions

            Triggers

            Behaviors




© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Old WPF ( No Silverlight )
       <Button Content="Click Me">
           <Button.Triggers>

                <EventTrigger RoutedEvent="Click">
                   <EventTrigger.Actions>
                      <BeginStoryboard Storyboard="{StaticResource sbSpin}"/>
                   </EventTrigger.Actions>
                </EventTrigger>

                <MultiTrigger>
                  <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True" />
                    <Condition Property="Content" Value="{x:Null}" />
                  </MultiTrigger.Conditions>
                  <Setter Property="Background" Value="Yellow" />
                </MultiTrigger>

           </Button.Triggers>
       </Button>


© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
.NET 3.5 WPF ( When __, Do __                                                  )




© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Action Way
       <Button Content="Click Me">

       <i:Interaction.Triggers>
          <i:EventTrigger EventName="Click">
             <E4D:MyAction TargetName="lbTrace" />
          </i:EventTrigger>
       </i:Interaction.Triggers>

       </Button>



       public class MyAction : TargetedTriggerAction<DependencyObject>
       {
           public MyAction() { ... }

             protected override void Invoke(object o) { ... }
       }




© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Perform on
                                                                                  somebody else




© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Action


© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Trigger ( When )
            Invokes a bunch of actions at a point when it
             decides to do that.
                  Event Trigger
                  Timer Trigger
                  Size Trigger


            The Attach & Detach connect to
             the target.




© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Timer Trigger Sample
        public class TimerTrigger : TriggerBase<DependencyObject>
        {
           public TimeSpan Interval { get; set; }
             protected override void OnAttached()
             {
                timer = new DispatcherTimer();
                timer.Interval = Interval;
                timer.Tick += OnTick; timer.Start();
             }
             void OnTick(object sender, EventArgs e)
             {
                this.InvokeActions(null);
             }
             protected override void OnDetaching()
             {
                timer.Tick -= OnTick; timer = null;
             }

             DispatcherTimer timer;
        }

© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Custom Trigger


© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Behavior
            Behavior don’t need the “When” ( Trigger ),
             and don’t have the Invoke.




© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Behavior with Command
        public class MethodBehavior : Behavior<DependencyObject>
        {
           public ICommand Command { get; set; }
             public MethodBehavior()
             {
                 Command = new ActionCommand( MyMethod );
             }

             private void MyMethod()
             {            <Button Content="Click Me“>
                // TODO: <i:Interaction.Behaviors>
             }               <E4D:MethodBehavior>
        }                       <i:Interaction.Triggers>
                                 <i:KeyTrigger SourceName="...">
                                    <i:InvokeCommandAction CommandName="Command" />
                                 </i:KeyTrigger>
                                </i:Interaction.Triggers>
                              </E4D:MethodBehavior>
                          </i:Interaction.Behaviors>
                          </Button>
© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Behaviors


© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Blend Behaviors




© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Fluid Move Behavior
            Behavior that watches an element (or a set of
             elements) for layout changes, and moves the
             element smoothly to the new position when
             needed.

         <ei:FluidMoveBehavior Duration="00:00:01" AppliesTo="Children">
               <ei:FluidMoveBehavior.EaseY>
                     <BackEase EasingMode="EaseOut" Amplitude="0.5"/>
              </ei:FluidMoveBehavior.EaseY>
             <ei:FluidMoveBehavior.EaseX>
                     <BackEase EasingMode="EaseOut" Amplitude="0.5"/>
              </ei:FluidMoveBehavior.EaseX>
         </ei:FluidMoveBehavior>




© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Fluid Move Behavior




© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Fluid Move Behavior


© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Fluid Layout in VSM
            Animation between states.
                     - Transition Effect
                     - Easing Function




© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Fluid Layout in VSM



© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Layout States & Transition
            Layout States animate the state changes for
             you at the appropriate times, as your items are
             added to or removed from the list.
                  Edit the ItemContainerStyle and ItemsPanel.




© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Layout States & Transition


© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
FluidMoveTagSetBehavior




© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Fluid Move Tag Set
          Behavior


© 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il

More Related Content

Viewers also liked

Presentation Visual Aids V3
Presentation Visual Aids  V3Presentation Visual Aids  V3
Presentation Visual Aids V3joe lo
 
Realtime Learning: Using Triggers to Know What the ?$# is Going On
Realtime Learning: Using Triggers to Know What the ?$# is Going OnRealtime Learning: Using Triggers to Know What the ?$# is Going On
Realtime Learning: Using Triggers to Know What the ?$# is Going OnDomino Data Lab
 
MVVM de A à Z
MVVM de A à ZMVVM de A à Z
MVVM de A à ZMicrosoft
 
7 Things That Make Content Go Viral
7 Things That Make Content Go Viral7 Things That Make Content Go Viral
7 Things That Make Content Go ViralDerek Halpern
 
Gamification - Extrinsic vs. Intrinsic Rewards
Gamification - Extrinsic vs. Intrinsic RewardsGamification - Extrinsic vs. Intrinsic Rewards
Gamification - Extrinsic vs. Intrinsic RewardsJerome Sudan
 
What Do Real Women Look Like? 100 Stock Photos of Real Women
What Do Real Women Look Like? 100 Stock Photos of Real WomenWhat Do Real Women Look Like? 100 Stock Photos of Real Women
What Do Real Women Look Like? 100 Stock Photos of Real WomenTwenty20 Inc.
 
Deep Learning through Examples
Deep Learning through ExamplesDeep Learning through Examples
Deep Learning through ExamplesSri Ambati
 

Viewers also liked (9)

Presentation Visual Aids V3
Presentation Visual Aids  V3Presentation Visual Aids  V3
Presentation Visual Aids V3
 
Realtime Learning: Using Triggers to Know What the ?$# is Going On
Realtime Learning: Using Triggers to Know What the ?$# is Going OnRealtime Learning: Using Triggers to Know What the ?$# is Going On
Realtime Learning: Using Triggers to Know What the ?$# is Going On
 
MVVM de A à Z
MVVM de A à ZMVVM de A à Z
MVVM de A à Z
 
Triggers and Cravings - Live Webinar
Triggers and Cravings - Live WebinarTriggers and Cravings - Live Webinar
Triggers and Cravings - Live Webinar
 
7 Things That Make Content Go Viral
7 Things That Make Content Go Viral7 Things That Make Content Go Viral
7 Things That Make Content Go Viral
 
Gamification - Extrinsic vs. Intrinsic Rewards
Gamification - Extrinsic vs. Intrinsic RewardsGamification - Extrinsic vs. Intrinsic Rewards
Gamification - Extrinsic vs. Intrinsic Rewards
 
Intrinsic and Extrinsic Motivation
Intrinsic and Extrinsic MotivationIntrinsic and Extrinsic Motivation
Intrinsic and Extrinsic Motivation
 
What Do Real Women Look Like? 100 Stock Photos of Real Women
What Do Real Women Look Like? 100 Stock Photos of Real WomenWhat Do Real Women Look Like? 100 Stock Photos of Real Women
What Do Real Women Look Like? 100 Stock Photos of Real Women
 
Deep Learning through Examples
Deep Learning through ExamplesDeep Learning through Examples
Deep Learning through Examples
 

Similar to Triggers, actions & behaviors in XAML

Asp.net mvc internals & extensibility
Asp.net mvc internals & extensibilityAsp.net mvc internals & extensibility
Asp.net mvc internals & extensibilityEyal Vardi
 
Asp.Net Mvc Internals &amp; Extensibility
Asp.Net Mvc Internals &amp; ExtensibilityAsp.Net Mvc Internals &amp; Extensibility
Asp.Net Mvc Internals &amp; ExtensibilityEyal Vardi
 
Async & Parallel in JavaScript
Async & Parallel in JavaScriptAsync & Parallel in JavaScript
Async & Parallel in JavaScriptEyal Vardi
 
Prism Navigation
Prism NavigationPrism Navigation
Prism NavigationEyal Vardi
 
Asp.net web api extensibility
Asp.net web api extensibilityAsp.net web api extensibility
Asp.net web api extensibilityEyal Vardi
 
Web api crud operations
Web api crud operationsWeb api crud operations
Web api crud operationsEyal Vardi
 
AMD & Require.js
AMD & Require.jsAMD & Require.js
AMD & Require.jsEyal Vardi
 
Mvc & java script
Mvc & java scriptMvc & java script
Mvc & java scriptEyal Vardi
 
Asp.net mvc filters
Asp.net mvc filtersAsp.net mvc filters
Asp.net mvc filtersEyal Vardi
 
МИХАЙЛО БОДНАРЧУК «SuperCharged End to End Testing with CodeceptJS» QADay 2019
МИХАЙЛО БОДНАРЧУК «SuperCharged End to End Testing with CodeceptJS»  QADay 2019МИХАЙЛО БОДНАРЧУК «SuperCharged End to End Testing with CodeceptJS»  QADay 2019
МИХАЙЛО БОДНАРЧУК «SuperCharged End to End Testing with CodeceptJS» QADay 2019GoQA
 
Coherence 12.1.2 Live Events
Coherence 12.1.2 Live EventsCoherence 12.1.2 Live Events
Coherence 12.1.2 Live Eventsharvraja
 
Designing for Windows Phone 8
Designing for Windows Phone 8Designing for Windows Phone 8
Designing for Windows Phone 8David Isbitski
 
AngularJS: What's the Big Deal?
AngularJS: What's the Big Deal?AngularJS: What's the Big Deal?
AngularJS: What's the Big Deal?Jim Duffy
 
Maximise the Power of OSGi - Carsten Ziegeler & David Bosschaert
Maximise the Power of OSGi - Carsten Ziegeler & David BosschaertMaximise the Power of OSGi - Carsten Ziegeler & David Bosschaert
Maximise the Power of OSGi - Carsten Ziegeler & David Bosschaertmfrancis
 
Maximize the power of OSGi
Maximize the power of OSGiMaximize the power of OSGi
Maximize the power of OSGiDavid Bosschaert
 

Similar to Triggers, actions & behaviors in XAML (20)

Asp.net mvc internals & extensibility
Asp.net mvc internals & extensibilityAsp.net mvc internals & extensibility
Asp.net mvc internals & extensibility
 
Asp.Net Mvc Internals &amp; Extensibility
Asp.Net Mvc Internals &amp; ExtensibilityAsp.Net Mvc Internals &amp; Extensibility
Asp.Net Mvc Internals &amp; Extensibility
 
Async & Parallel in JavaScript
Async & Parallel in JavaScriptAsync & Parallel in JavaScript
Async & Parallel in JavaScript
 
Prism Navigation
Prism NavigationPrism Navigation
Prism Navigation
 
Asp.net web api extensibility
Asp.net web api extensibilityAsp.net web api extensibility
Asp.net web api extensibility
 
Models
ModelsModels
Models
 
Web api crud operations
Web api crud operationsWeb api crud operations
Web api crud operations
 
AMD & Require.js
AMD & Require.jsAMD & Require.js
AMD & Require.js
 
Zero To Dojo
Zero To DojoZero To Dojo
Zero To Dojo
 
Mvc & java script
Mvc & java scriptMvc & java script
Mvc & java script
 
Asp.net mvc filters
Asp.net mvc filtersAsp.net mvc filters
Asp.net mvc filters
 
МИХАЙЛО БОДНАРЧУК «SuperCharged End to End Testing with CodeceptJS» QADay 2019
МИХАЙЛО БОДНАРЧУК «SuperCharged End to End Testing with CodeceptJS»  QADay 2019МИХАЙЛО БОДНАРЧУК «SuperCharged End to End Testing with CodeceptJS»  QADay 2019
МИХАЙЛО БОДНАРЧУК «SuperCharged End to End Testing with CodeceptJS» QADay 2019
 
Coherence 12.1.2 Live Events
Coherence 12.1.2 Live EventsCoherence 12.1.2 Live Events
Coherence 12.1.2 Live Events
 
Designing for Windows Phone 8
Designing for Windows Phone 8Designing for Windows Phone 8
Designing for Windows Phone 8
 
FSD JavaScript Part 11.pdf
FSD JavaScript Part 11.pdfFSD JavaScript Part 11.pdf
FSD JavaScript Part 11.pdf
 
AngularJS: What's the Big Deal?
AngularJS: What's the Big Deal?AngularJS: What's the Big Deal?
AngularJS: What's the Big Deal?
 
Views
ViewsViews
Views
 
Maximise the Power of OSGi - Carsten Ziegeler & David Bosschaert
Maximise the Power of OSGi - Carsten Ziegeler & David BosschaertMaximise the Power of OSGi - Carsten Ziegeler & David Bosschaert
Maximise the Power of OSGi - Carsten Ziegeler & David Bosschaert
 
Maximize the power of OSGi
Maximize the power of OSGiMaximize the power of OSGi
Maximize the power of OSGi
 
AngularJS Basics with Example
AngularJS Basics with ExampleAngularJS Basics with Example
AngularJS Basics with Example
 

More from Eyal Vardi

Smart Contract
Smart ContractSmart Contract
Smart ContractEyal Vardi
 
Rachel's grandmother's recipes
Rachel's grandmother's recipesRachel's grandmother's recipes
Rachel's grandmother's recipesEyal Vardi
 
Performance Optimization In Angular 2
Performance Optimization In Angular 2Performance Optimization In Angular 2
Performance Optimization In Angular 2Eyal Vardi
 
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)Eyal Vardi
 
Angular 2 NgModule
Angular 2 NgModuleAngular 2 NgModule
Angular 2 NgModuleEyal Vardi
 
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.xUpgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.xEyal Vardi
 
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time CompilationAngular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time CompilationEyal Vardi
 
Routing And Navigation
Routing And NavigationRouting And Navigation
Routing And NavigationEyal Vardi
 
Angular 2 Architecture
Angular 2 ArchitectureAngular 2 Architecture
Angular 2 ArchitectureEyal Vardi
 
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.xAngular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.xEyal Vardi
 
Angular 2.0 Views
Angular 2.0 ViewsAngular 2.0 Views
Angular 2.0 ViewsEyal Vardi
 
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Eyal Vardi
 
Template syntax in Angular 2.0
Template syntax in Angular 2.0Template syntax in Angular 2.0
Template syntax in Angular 2.0Eyal Vardi
 
Http Communication in Angular 2.0
Http Communication in Angular 2.0Http Communication in Angular 2.0
Http Communication in Angular 2.0Eyal Vardi
 
Angular 2.0 Dependency injection
Angular 2.0 Dependency injectionAngular 2.0 Dependency injection
Angular 2.0 Dependency injectionEyal Vardi
 
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and NavigationAngular 2.0 Routing and Navigation
Angular 2.0 Routing and NavigationEyal Vardi
 
Angular 2.0 Pipes
Angular 2.0 PipesAngular 2.0 Pipes
Angular 2.0 PipesEyal Vardi
 
Angular 2.0 forms
Angular 2.0 formsAngular 2.0 forms
Angular 2.0 formsEyal Vardi
 
Modules and injector
Modules and injectorModules and injector
Modules and injectorEyal Vardi
 

More from Eyal Vardi (20)

Why magic
Why magicWhy magic
Why magic
 
Smart Contract
Smart ContractSmart Contract
Smart Contract
 
Rachel's grandmother's recipes
Rachel's grandmother's recipesRachel's grandmother's recipes
Rachel's grandmother's recipes
 
Performance Optimization In Angular 2
Performance Optimization In Angular 2Performance Optimization In Angular 2
Performance Optimization In Angular 2
 
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)
 
Angular 2 NgModule
Angular 2 NgModuleAngular 2 NgModule
Angular 2 NgModule
 
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.xUpgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
 
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time CompilationAngular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time Compilation
 
Routing And Navigation
Routing And NavigationRouting And Navigation
Routing And Navigation
 
Angular 2 Architecture
Angular 2 ArchitectureAngular 2 Architecture
Angular 2 Architecture
 
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.xAngular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.x
 
Angular 2.0 Views
Angular 2.0 ViewsAngular 2.0 Views
Angular 2.0 Views
 
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
 
Template syntax in Angular 2.0
Template syntax in Angular 2.0Template syntax in Angular 2.0
Template syntax in Angular 2.0
 
Http Communication in Angular 2.0
Http Communication in Angular 2.0Http Communication in Angular 2.0
Http Communication in Angular 2.0
 
Angular 2.0 Dependency injection
Angular 2.0 Dependency injectionAngular 2.0 Dependency injection
Angular 2.0 Dependency injection
 
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and NavigationAngular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
 
Angular 2.0 Pipes
Angular 2.0 PipesAngular 2.0 Pipes
Angular 2.0 Pipes
 
Angular 2.0 forms
Angular 2.0 formsAngular 2.0 forms
Angular 2.0 forms
 
Modules and injector
Modules and injectorModules and injector
Modules and injector
 

Recently uploaded

Design principles on typography in design
Design principles on typography in designDesign principles on typography in design
Design principles on typography in designnooreen17
 
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一Fi sss
 
Untitled presedddddddddddddddddntation (1).pptx
Untitled presedddddddddddddddddntation (1).pptxUntitled presedddddddddddddddddntation (1).pptx
Untitled presedddddddddddddddddntation (1).pptxmapanig881
 
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,Aginakm1
 
Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...
Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...
Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...mrchrns005
 
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10uasjlagroup
 
Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...
Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...
Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...Yantram Animation Studio Corporation
 
Pharmaceutical Packaging for the elderly.pdf
Pharmaceutical Packaging for the elderly.pdfPharmaceutical Packaging for the elderly.pdf
Pharmaceutical Packaging for the elderly.pdfAayushChavan5
 
澳洲UQ学位证,昆士兰大学毕业证书1:1制作
澳洲UQ学位证,昆士兰大学毕业证书1:1制作澳洲UQ学位证,昆士兰大学毕业证书1:1制作
澳洲UQ学位证,昆士兰大学毕业证书1:1制作aecnsnzk
 
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证nhjeo1gg
 
原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档208367051
 
MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...
MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...
MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...katerynaivanenko1
 
Apresentação Clamo Cristo -letra música Matheus Rizzo
Apresentação Clamo Cristo -letra música Matheus RizzoApresentação Clamo Cristo -letra música Matheus Rizzo
Apresentação Clamo Cristo -letra música Matheus RizzoCarolTelles6
 
How to Empower the future of UX Design with Gen AI
How to Empower the future of UX Design with Gen AIHow to Empower the future of UX Design with Gen AI
How to Empower the future of UX Design with Gen AIyuj
 
Create Web Pages by programming of your chice.pdf
Create Web Pages by programming of your chice.pdfCreate Web Pages by programming of your chice.pdf
Create Web Pages by programming of your chice.pdfworkingdev2003
 
Design and Managing Service in the field of tourism and hospitality industry
Design and Managing Service in the field of tourism and hospitality industryDesign and Managing Service in the field of tourism and hospitality industry
Design and Managing Service in the field of tourism and hospitality industryrioverosanniejoy
 
Iconic Global Solution - web design, Digital Marketing services
Iconic Global Solution - web design, Digital Marketing servicesIconic Global Solution - web design, Digital Marketing services
Iconic Global Solution - web design, Digital Marketing servicesIconic global solution
 
Pearl Disrtrict urban analyusis study pptx
Pearl Disrtrict urban analyusis study pptxPearl Disrtrict urban analyusis study pptx
Pearl Disrtrict urban analyusis study pptxDanielTamiru4
 
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一diploma 1
 

Recently uploaded (20)

Design principles on typography in design
Design principles on typography in designDesign principles on typography in design
Design principles on typography in design
 
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
 
Untitled presedddddddddddddddddntation (1).pptx
Untitled presedddddddddddddddddntation (1).pptxUntitled presedddddddddddddddddntation (1).pptx
Untitled presedddddddddddddddddntation (1).pptx
 
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,
 
Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...
Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...
Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...
 
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
 
Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...
Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...
Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...
 
Pharmaceutical Packaging for the elderly.pdf
Pharmaceutical Packaging for the elderly.pdfPharmaceutical Packaging for the elderly.pdf
Pharmaceutical Packaging for the elderly.pdf
 
澳洲UQ学位证,昆士兰大学毕业证书1:1制作
澳洲UQ学位证,昆士兰大学毕业证书1:1制作澳洲UQ学位证,昆士兰大学毕业证书1:1制作
澳洲UQ学位证,昆士兰大学毕业证书1:1制作
 
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
 
原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档
 
MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...
MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...
MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...
 
Apresentação Clamo Cristo -letra música Matheus Rizzo
Apresentação Clamo Cristo -letra música Matheus RizzoApresentação Clamo Cristo -letra música Matheus Rizzo
Apresentação Clamo Cristo -letra música Matheus Rizzo
 
How to Empower the future of UX Design with Gen AI
How to Empower the future of UX Design with Gen AIHow to Empower the future of UX Design with Gen AI
How to Empower the future of UX Design with Gen AI
 
Create Web Pages by programming of your chice.pdf
Create Web Pages by programming of your chice.pdfCreate Web Pages by programming of your chice.pdf
Create Web Pages by programming of your chice.pdf
 
Design and Managing Service in the field of tourism and hospitality industry
Design and Managing Service in the field of tourism and hospitality industryDesign and Managing Service in the field of tourism and hospitality industry
Design and Managing Service in the field of tourism and hospitality industry
 
Iconic Global Solution - web design, Digital Marketing services
Iconic Global Solution - web design, Digital Marketing servicesIconic Global Solution - web design, Digital Marketing services
Iconic Global Solution - web design, Digital Marketing services
 
Pearl Disrtrict urban analyusis study pptx
Pearl Disrtrict urban analyusis study pptxPearl Disrtrict urban analyusis study pptx
Pearl Disrtrict urban analyusis study pptx
 
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一
 

Triggers, actions & behaviors in XAML

  • 1. Triggers, Actions & Behaviors Eyal Vardi CEO E4D Solutions LTD Microsoft MVP Visual C# blog: www.eVardi.com
  • 2. Agenda  Actions  Triggers  Behaviors © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 3. Old WPF ( No Silverlight ) <Button Content="Click Me"> <Button.Triggers> <EventTrigger RoutedEvent="Click"> <EventTrigger.Actions> <BeginStoryboard Storyboard="{StaticResource sbSpin}"/> </EventTrigger.Actions> </EventTrigger> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="IsMouseOver" Value="True" /> <Condition Property="Content" Value="{x:Null}" /> </MultiTrigger.Conditions> <Setter Property="Background" Value="Yellow" /> </MultiTrigger> </Button.Triggers> </Button> © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 4. .NET 3.5 WPF ( When __, Do __ ) © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 5. Action Way <Button Content="Click Me"> <i:Interaction.Triggers> <i:EventTrigger EventName="Click"> <E4D:MyAction TargetName="lbTrace" /> </i:EventTrigger> </i:Interaction.Triggers> </Button> public class MyAction : TargetedTriggerAction<DependencyObject> { public MyAction() { ... } protected override void Invoke(object o) { ... } } © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 6. Perform on somebody else © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 7. Action © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 8. Trigger ( When )  Invokes a bunch of actions at a point when it decides to do that.  Event Trigger  Timer Trigger  Size Trigger  The Attach & Detach connect to the target. © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 9. Timer Trigger Sample public class TimerTrigger : TriggerBase<DependencyObject> { public TimeSpan Interval { get; set; } protected override void OnAttached() { timer = new DispatcherTimer(); timer.Interval = Interval; timer.Tick += OnTick; timer.Start(); } void OnTick(object sender, EventArgs e) { this.InvokeActions(null); } protected override void OnDetaching() { timer.Tick -= OnTick; timer = null; } DispatcherTimer timer; } © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 10. Custom Trigger © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 11. Behavior  Behavior don’t need the “When” ( Trigger ), and don’t have the Invoke. © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 12. Behavior with Command public class MethodBehavior : Behavior<DependencyObject> { public ICommand Command { get; set; } public MethodBehavior() { Command = new ActionCommand( MyMethod ); } private void MyMethod() { <Button Content="Click Me“> // TODO: <i:Interaction.Behaviors> } <E4D:MethodBehavior> } <i:Interaction.Triggers> <i:KeyTrigger SourceName="..."> <i:InvokeCommandAction CommandName="Command" /> </i:KeyTrigger> </i:Interaction.Triggers> </E4D:MethodBehavior> </i:Interaction.Behaviors> </Button> © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 13. Behaviors © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 14. Blend Behaviors © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 15. Fluid Move Behavior  Behavior that watches an element (or a set of elements) for layout changes, and moves the element smoothly to the new position when needed. <ei:FluidMoveBehavior Duration="00:00:01" AppliesTo="Children"> <ei:FluidMoveBehavior.EaseY> <BackEase EasingMode="EaseOut" Amplitude="0.5"/> </ei:FluidMoveBehavior.EaseY> <ei:FluidMoveBehavior.EaseX> <BackEase EasingMode="EaseOut" Amplitude="0.5"/> </ei:FluidMoveBehavior.EaseX> </ei:FluidMoveBehavior> © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 16. Fluid Move Behavior © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 17. Fluid Move Behavior © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 18. Fluid Layout in VSM  Animation between states.  - Transition Effect  - Easing Function © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 19. Fluid Layout in VSM © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 20. Layout States & Transition  Layout States animate the state changes for you at the appropriate times, as your items are added to or removed from the list.  Edit the ItemContainerStyle and ItemsPanel. © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 21. Layout States & Transition © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 22. FluidMoveTagSetBehavior © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 23. Fluid Move Tag Set Behavior © 2008 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il