Monday, March 28, 2016

Xaml Triggers and VisualState

DataTemplate/ControlTemplate/Style has triggers
Tigger can do setter, Enter exit action
MultiDataTrigger and MultiTrigger both have .Conditions
StoreBoard.Target=BackGround.(SolidBrush.Color)
This breaks the rule that code should not know xaml view

Xaml can only define Vstate need code behind to move
each state can have storeboard for transition effect

                    <ControlTemplate.Triggers>
                        <Trigger Property="" >
                            <Setter />
                        </Trigger>
                        <EventTrigger>
                            <BeginStoryboard>
                                <Storyboard></Storyboard>
                            </BeginStoryboard>
                            <EventTrigger.EnterActions>
                                
                            </EventTrigger.EnterActions>
                            <EventTrigger.ExitActions>
                                <StopStoryboard>
                                    
                                </StopStoryboard>
                            </EventTrigger.ExitActions>
                        </EventTrigger>
                        <DataTrigger>
                            <DataTrigger.EnterActions>
                                <BeginStoryboard>
                                    
                                </BeginStoryboard>
               
                            </DataTrigger.EnterActions>
                            <DataTrigger.ExitActions>
                                <StopStoryboard></StopStoryboard>
                            </DataTrigger.ExitActions>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
                <DataTemplate>
                    <DataTemplate.Triggers>
                        
                    </DataTemplate.Triggers>
                </DataTemplate>

            <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                
                            </MultiDataTrigger.Conditions>
                        </MultiDataTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                
                            </MultiTrigger.Conditions>
                        </MultiTrigger>

         <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Name="PART_border">
                        <ContentPresenter></ContentPresenter>

                        <VisualStateManager.VisualStateGroups>
                            <VisualState Name="normal"/>
                            <VisualState Name="MouseOver" >
 <Storyboard Storyboard.TargetProperty="" Storyboard.TargetName="" />
 <VisualState>
                        </VisualStateManager.VisualStateGroups>
                    </Border>

VisualStateManager.GoToState(this, "normal", true);

No comments:

Post a Comment