我有以下XAML,其中有三個組合框疊加。在這些組框的標題中是複選框。摺疊/展開Groupboxes
我想實現的是:當選中/取消選中一個框時,我希望相應的groupbox以平滑的動畫緩慢展開/摺疊。
我在Blend 4中嘗試這個,但是我是一個新手。有關如何實現這一目標的任何幫助?特別是,動畫可以在XAML中獨立存在嗎?
UPDATE:This seems to come close,但我不太明白
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="WpfControlLibrary1.MainControl"
x:Name="MultiVol">
<StackPanel x:Name="LayoutRoot" HorizontalAlignment="Stretch">
<GroupBox Margin="8,0" BorderBrush="#FF88B1D8">
<GroupBox.Header>
<WrapPanel>
<CheckBox IsChecked="True" VerticalAlignment="Center" />
<Label Content="Volatility" Background="#00000000" Foreground="#FF0033FF" FontWeight="Bold" FontFamily="/WpfControlLibrary1;component/Fonts/#Tahoma" />
</WrapPanel>
</GroupBox.Header>
<UniformGrid Columns="2">
<Label Content="Spots"></Label>
<TextBox AcceptsReturn="False" AcceptsTab="True" AllowDrop="True" IsTabStop="True" />
<Label Content="Hist. references" />
<TextBox AcceptsReturn="False" AcceptsTab="True" AllowDrop="True" IsTabStop="True" />
<Label Content="Tenors" />
<TextBox AcceptsReturn="False" AcceptsTab="True" AllowDrop="True" IsTabStop="True" />
</UniformGrid>
</GroupBox>
<GroupBox Margin="8,0" BorderBrush="#FF88B1D8">
<GroupBox.Header>
<WrapPanel>
<CheckBox IsChecked="True" VerticalAlignment="Center" />
<Label Content="Skew" Background="#00000000" Foreground="#FF0033FF" FontWeight="Bold" FontFamily="/WpfControlLibrary1;component/Fonts/#Tahoma" />
</WrapPanel>
</GroupBox.Header>
<UniformGrid Columns="2">
<Label Content="Spot Intervals"></Label>
<TextBox AcceptsReturn="False" AcceptsTab="True" AllowDrop="True" IsTabStop="True" />
<Label Content="Hist. references" />
<TextBox AcceptsReturn="False" AcceptsTab="True" AllowDrop="True" IsTabStop="True" />
<Label Content="Tenors" />
<TextBox AcceptsReturn="False" AcceptsTab="True" AllowDrop="True" IsTabStop="True" />
<Label Content="Compute 'Power'" />
<CheckBox IsChecked="False" VerticalAlignment="Center"/>
</UniformGrid>
</GroupBox>
<GroupBox Margin="8,0" BorderBrush="#FF88B1D8">
<GroupBox.Header>
<WrapPanel>
<CheckBox IsChecked="True" VerticalAlignment="Center" />
<Label Content="Term structure" Background="#00000000" Foreground="#FF0033FF" FontWeight="Bold" FontFamily="/WpfControlLibrary1;component/Fonts/#Tahoma" />
</WrapPanel>
</GroupBox.Header>
<UniformGrid Columns="2">
<Label Content="Spots" />
<TextBox AcceptsReturn="False" AcceptsTab="True" AllowDrop="True" IsTabStop="True" />
<Label Content="Tenors" />
<TextBox AcceptsReturn="False" AcceptsTab="True" AllowDrop="True" IsTabStop="True" />
</UniformGrid>
</GroupBox>
</StackPanel>
</UserControl>
偉大的作品!謝謝 ! – Jerome 2012-01-30 14:08:29
但是,如何從=「Auto」指定?目前默認值使它有點怪異 – Jerome 2012-01-30 14:09:00
另外,如何獲得更小的時間跨度?我試過0:0:0.5和0:0:0:1,都導致例外 – Jerome 2012-01-30 14:13:41