修改Expanderview样式,
<Style targettype="toolkit:ExpanderView"> <Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="HorizontalContentAlignment" Value="Stretch"/> <Setter Property="ItemsPanel"> <Setter.Value> <ItemsPanelTemplate> <StackPanel/> </ItemsPanelTemplate> </Setter.Value> </Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate targettype="toolkit:ExpanderView"> <Grid> <Grid.Resources> <QuadraticEase x:Key="QuadraticEaSEOut" EasingMode="EaSEOut"/> <QuadraticEase x:Key="QuadraticEaseInOut" EasingMode="EaseInOut"/> </Grid.Resources> <Grid.ColumnDeFinitions> <ColumnDeFinition Width="41"/> <ColumnDeFinition Width="*"/> </Grid.ColumnDeFinitions> <Grid.RowDeFinitions> <RowDeFinition Height="Auto"/> <RowDeFinition Height="Auto"/> <RowDeFinition Height="Auto"/> </Grid.RowDeFinitions> <visualstatemanager.VisualStateGroups> <VisualStateGroup x:Name="ExpansionStates"> <VisualStateGroup.Transitions> <VisualTransition From="Collapsed" GeneratedDuration="0:0:0.15" To="Expanded"> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="ItemsCanvas"> <EasingDoubleKeyFrame EasingFunction="{StaticResource QuadraticEaSEOut}" KeyTime="0:0:0.00" Value="0"/> <EasingDoubleKeyFrame x:Name="CollapsedToExpandedKeyFrame" EasingFunction="{StaticResource QuadraticEaSEOut}" KeyTime="0:0:0.15" Value="1"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimation Duration="0" To="1.0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ItemsCanvas"/> </Storyboard> </VisualTransition> <VisualTransition From="Expanded" GeneratedDuration="0:0:0.15" To="Collapsed"> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="ItemsCanvas"> <EasingDoubleKeyFrame x:Name="ExpandedToCollapsedKeyFrame" EasingFunction="{StaticResource QuadraticEaseInOut}" KeyTime="0:0:0.00" Value="1"/> <EasingDoubleKeyFrame EasingFunction="{StaticResource QuadraticEaseInOut}" KeyTime="0:0:0.15" Value="0"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ItemsCanvas"> <EasingDoubleKeyFrame EasingFunction="{StaticResource QuadraticEaseInOut}" KeyTime="0:0:0.00" Value="1.0"/> <EasingDoubleKeyFrame EasingFunction="{StaticResource QuadraticEaseInOut}" KeyTime="0:0:0.15" Value="0.0"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="ItemsCanvas"> <EasingDoubleKeyFrame EasingFunction="{StaticResource QuadraticEaseInOut}" KeyTime="0:0:0.00" Value="0.0"/> <EasingDoubleKeyFrame EasingFunction="{StaticResource QuadraticEaseInOut}" KeyTime="0:0:0.15" Value="-35"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </VisualTransition> </VisualStateGroup.Transitions> <VisualState x:Name="Collapsed"> <Storyboard> <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="ItemsCanvas"/> <DoubleAnimation Duration="0" To="0.0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ItemsCanvas"/> </Storyboard> </VisualState> <VisualState x:Name="Expanded"> <Storyboard> <DoubleAnimation Duration="0" Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="ItemsCanvas"/> <DoubleAnimation Duration="0" To="1.0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ItemsCanvas"/> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:Name="ExpandabilityStates"> <VisualState x:Name="Expandable"/> <VisualState x:Name="NonExpandable"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ExpandableContent"> <discreteObjectKeyFrame KeyTime="0:0:0.0" Value="Collapsed"/> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Line"> <discreteObjectKeyFrame KeyTime="0:0:0.0" Value="Collapsed"/> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="NonExpandableContent"> <discreteObjectKeyFrame KeyTime="0:0:0.0" Value="Visible"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </visualstatemanager.VisualStateGroups> <ListBoxItem x:Name="ExpandableContent" Grid.ColumnSpan="2" Grid.Column="0" toolkit:TiltEffect.IsTiltEnabled="True" Grid.Row="0" Grid.RowSpan="2"> <Grid> <Grid.ColumnDeFinitions> <ColumnDeFinition Width="41"/> <ColumnDeFinition Width="*"/> </Grid.ColumnDeFinitions> <Grid.RowDeFinitions> <RowDeFinition Height="Auto"/> <RowDeFinition Height="Auto"/> <RowDeFinition Height="Auto"/> </Grid.RowDeFinitions> <ContentControl x:Name="Header" Grid.ColumnSpan="2" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Grid.Column="0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Grid.Row="0"/> <ContentControl x:Name="Expander" ContentTemplate="{TemplateBinding ExpanderTemplate}" Content="{TemplateBinding Expander}" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Margin="11,0" Grid.Row="1"/> <Grid x:Name="ExpanderPanel" Background="Transparent" Grid.ColumnSpan="2" Grid.Column="0" Grid.Row="0" Grid.RowSpan="2"/> </Grid> </ListBoxItem> <Line x:Name="Line" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="1" Grid.RowSpan="2" Stretch="Fill" stroke="White" strokeThickness="3" X1="0" X2="0" Y1="0" Y2="1"/> <ContentControl x:Name="NonExpandableContent" Grid.ColumnSpan="2" ContentTemplate="{TemplateBinding NonExpandableHeaderTemplate}" Content="{TemplateBinding NonExpandableHeader}" Grid.Column="0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Grid.Row="0" Grid.RowSpan="2" Visibility="Collapsed"/> <Canvas x:Name="ItemsCanvas" Grid.Column="1" Margin="11,0" Opacity="0.0" Grid.Row="2"> <Canvas.RenderTransform> <CompositeTransform TranslateY="0.0"/> </Canvas.RenderTransform> <ItemsPresenter x:Name="Presenter"/> </Canvas> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。