Silverlight 中 Expander 的列表框无法正确折叠

发布于 2024-11-10 18:18:26 字数 1506 浏览 8 评论 0原文

我在 Silverlight 中有一个扩展器列表框。它们扩展得很好,但是,当它们折叠时,包含扩展器的堆栈面板不会最小化。我在这里附上了屏幕截图。 在此处输入图像描述

 <Grid  Background="White">

            <StackPanel Orientation="Vertical" Margin="5,5,5,5" Grid.Column="0" MinWidth="700">
            <controls:Expander Expanded="Expander_Expanded" Name="expander1" Margin="5,0,0,5"  Header="{Binding Name}" HorizontalAlignment="Stretch" FontSize="15" FontFamily="Arial" FontWeight="Black" Height="Auto" >
                <StackPanel>
                    <ListBox   Height="Auto" Width="Auto" ItemsSource="{Binding ProductStreamCollection}" SelectionChanged="ListBox_SelectionChanged" MinWidth="700">
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="ListBoxItem">
                                <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
                            </Style>
                        </ListBox.ItemContainerStyle>

                        <ListBox.ItemTemplate>

                            <DataTemplate>
                                <view:StreamView/>


                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </StackPanel>
            </controls:Expander>



        </StackPanel>

    </Grid>

I have a listbox of expanders in Silverlight. They expand fine, however, when they collapse, the stackpanel containing the expander does not minimize. I have attached a screenshot here. enter image description here

 <Grid  Background="White">

            <StackPanel Orientation="Vertical" Margin="5,5,5,5" Grid.Column="0" MinWidth="700">
            <controls:Expander Expanded="Expander_Expanded" Name="expander1" Margin="5,0,0,5"  Header="{Binding Name}" HorizontalAlignment="Stretch" FontSize="15" FontFamily="Arial" FontWeight="Black" Height="Auto" >
                <StackPanel>
                    <ListBox   Height="Auto" Width="Auto" ItemsSource="{Binding ProductStreamCollection}" SelectionChanged="ListBox_SelectionChanged" MinWidth="700">
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="ListBoxItem">
                                <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
                            </Style>
                        </ListBox.ItemContainerStyle>

                        <ListBox.ItemTemplate>

                            <DataTemplate>
                                <view:StreamView/>


                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </StackPanel>
            </controls:Expander>



        </StackPanel>

    </Grid>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文