如何单击折叠的 WPF 扩展器后面的内容?

发布于 2024-12-07 19:36:16 字数 704 浏览 0 评论 0原文

当我折叠扩展器时,它明显折叠,但我无法单击后面的内容。

它占据的空间与扩展后的空间相同……

真的有可能折叠扩展器吗?

代码示例:

 <Grid>
    <Button Content="CannotClick" Height="23" HorizontalAlignment="Left" Margin="314,91,0,0" Name="button1" VerticalAlignment="Top" Width="75" />
    <Expander Header="expander1" Height="190" HorizontalAlignment="Left" Margin="306,32,0,0" Name="expander1" VerticalAlignment="Top" Width="95">
        <Grid>
            <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="7,106,0,0" Name="button2" VerticalAlignment="Top" Width="75" />
        </Grid>
    </Expander>
</Grid>

CannotClick 按钮位于扩展器的扩展区域下方。

When I collapse an expander, it visibly collapse, but I cannot click the content behind.

It occupies the same space as if it were expanded...

Is it possible to REALLY collapse an expander?

Code example:

 <Grid>
    <Button Content="CannotClick" Height="23" HorizontalAlignment="Left" Margin="314,91,0,0" Name="button1" VerticalAlignment="Top" Width="75" />
    <Expander Header="expander1" Height="190" HorizontalAlignment="Left" Margin="306,32,0,0" Name="expander1" VerticalAlignment="Top" Width="95">
        <Grid>
            <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="7,106,0,0" Name="button2" VerticalAlignment="Top" Width="75" />
        </Grid>
    </Expander>
</Grid>

The CannotClick Button is below the expanded area of the expander.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

下壹個目標 2024-12-14 19:36:16

我遇到了同样的问题,我的解决方案是不在 Expander 属性中指定 Expander 的高度。这允许修改编辑器和可执行文件中扩展器(折叠时)后面的内容

<Grid>
    <Button Content="CannotClick" Height="23" HorizontalAlignment="Left" Margin="314,91,0,0" Name="button1" VerticalAlignment="Top" Width="75" />
    <Expander Header="expander1" HorizontalAlignment="Left" Margin="306,32,0,0" Name="expander1" VerticalAlignment="Top" Width="95">
        <Grid>
            <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="7,106,0,0" Name="button2" VerticalAlignment="Top" Width="75" />
        </Grid>
    </Expander>
</Grid>

I was having the same problem and my solution was to not specify the Height of the Expander in the Expander property. This allow to modify content behind the expander(when collapsed) in the Editor and Executable

<Grid>
    <Button Content="CannotClick" Height="23" HorizontalAlignment="Left" Margin="314,91,0,0" Name="button1" VerticalAlignment="Top" Width="75" />
    <Expander Header="expander1" HorizontalAlignment="Left" Margin="306,32,0,0" Name="expander1" VerticalAlignment="Top" Width="95">
        <Grid>
            <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="7,106,0,0" Name="button2" VerticalAlignment="Top" Width="75" />
        </Grid>
    </Expander>
</Grid>
酒几许 2024-12-14 19:36:16

这不是扩展器的问题。问题是你的两个控件都放在同一个地方。

要解决此问题,请将行添加到网格并将每个控件插入到单独的行中,或者将网格替换为 StackPanel

This is not a problem with expander. The problem is that both your controls are placed on the same place.

To fix this, add rows to grid and insert each control into separate row, or replace grid with StackPanel

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文