两个彼此相邻的膨胀器不会扩大后者
由于某些原因,当我将两个膨胀器并排放置时,第一个膨胀器似乎在第二个膨胀器后面,并且不会扩大旁边的膨胀器?有没有办法可以在下面的代码中解决这个问题?两个彼此相邻的膨胀器不会扩大后者
<Grid>
<StackPanel Orientation="Horizontal" Margin="0,0,195,0">
<StackPanel.Triggers>
<EventTrigger RoutedEvent="Expander.Expanded" SourceName="expander">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation From="0" To="1.2" Duration="0:0:0.35" Storyboard.TargetName="listBox" Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(ScaleTransform.ScaleX)"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</StackPanel.Triggers>
<Expander x:Name="expander" Expanded="expander_Expanded" ExpandDirection="Right" Width="29">
<ListBox x:Name="listBox">
<ListBoxItem Content="ListBoxItem" VerticalAlignment="Top" />
<ListBoxItem Content="ListBoxItem" VerticalAlignment="Top" />
<ListBoxItem Content="ListBoxItem" VerticalAlignment="Top" />
<ListBox.LayoutTransform>
<ScaleTransform ScaleX="0" ScaleY="1"/>
</ListBox.LayoutTransform>
</ListBox>
</Expander>
<StackPanel Orientation="Horizontal" Margin="0,0,342,0" Width="318">
<StackPanel.Triggers>
<EventTrigger RoutedEvent="Expander.Expanded" SourceName="expander1">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation From="0" To="1.2" Duration="0:0:0.35" Storyboard.TargetName="listBox1" Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(ScaleTransform.ScaleX)"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</StackPanel.Triggers>
<Expander ExpandDirection="Right" Name="expander1" Width="29">
<ListBox Name="listBox1">
<ListBox.LayoutTransform>
<ScaleTransform ScaleX="0" ScaleY="1" />
</ListBox.LayoutTransform>
<ListBoxItem Content="ListBoxItem" VerticalAlignment="Top" />
<ListBoxItem Content="ListBoxItem" VerticalAlignment="Top" />
<ListBoxItem Content="ListBoxItem" VerticalAlignment="Top" />
</ListBox>
</Expander>
</StackPanel>
</StackPanel>
</Grid>
在
<Expander x:Name="expander"
Expanded="expander_Expanded"
ExpandDirection="Right"
Width="29">
删除Width="29"
,一切都会好起来的。
有没有办法增加扩展器的大小? – 2012-04-15 16:07:31
为什么?扩展器的大小取决于内容。您可以在'Expander.ActualWidth'属性中看到折叠状态和展开状态有不同的值。 – LPL 2012-04-15 16:18:18
没有抱歉,我在关闭状态下展开膨胀机的尺寸。 – 2012-04-15 17:02:21
请停止使用不相关的标签,这不是*关于* XML或HTML。 – 2012-04-15 15:23:01
问题的一部分可能是使用两个堆叠面板 - 为什么不使用一个呢? – 2012-04-15 15:26:07