我有一个项目将有多个选项卡。当用户选择一个选项卡时,我希望该选项卡内的网格滑出。我想我可以通过改变网格边距来实现这一点。我实际上有一个可行的解决方案,但它需要包含来自 Blend 的 2 个 DLL。我认为不使用 Blend 也可以实现相同的效果,但我无法弄清楚。下面是情节提要和 tabItems xaml
<Storyboard x:Key="tabAdminSlide">
<ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="grid1">
<EasingThicknessKeyFrame KeyTime="0" Value="400,0,0,0"/>
<EasingThicknessKeyFrame KeyTime="0:0:0.5" Value="0,0,0,0">
<EasingThicknessKeyFrame.EasingFunction>
<ExponentialEase EasingMode="EaseOut"/>
</EasingThicknessKeyFrame.EasingFunction>
</EasingThicknessKeyFrame>
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
<TabItem Header="Run as Admin" x:Name="tabAdmin" Background="LightBlue">
<i:Interaction.Triggers>
<ei:DataTrigger Binding="{Binding SelectedIndex, ElementName=tabControl}" Value="0">
<ei:ControlStoryboardAction Storyboard="{StaticResource tabAdminSlide}"/>
</ei:DataTrigger>
</i:Interaction.Triggers>
<Grid Height="Auto" x:Name="grid1" Width="Auto">
<Grid.Background>
<LinearGradientBrush StartPoint="-0.002,0.498" EndPoint="1.084,0.498">
<GradientStop Color="LightBlue" Offset="0.446" />
<GradientStop Color="White" Offset="1" />
</LinearGradientBrush>
</Grid.Background>
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="40,179,0,0" Name="button1" VerticalAlignment="Top" Width="75" Grid.ColumnSpan="2" />
</Grid>
</TabItem>
看起来像
<i:Interaction.Triggers>
<ei:DataTrigger Binding="{Binding SelectedIndex, ElementName=tabControl}" Value="0">
<ei:ControlStoryboardAction Storyboard="{StaticResource tabAdminSlide}"/>
</ei:DataTrigger>
</i:Interaction.Triggers>
是我需要更换的部件,但我不能确定。任何帮助都会得到帮助
谢谢。