单击按钮可折叠列表框中的详细信息 [英] Collapse details in listbox by clicking a button

查看:78
本文介绍了单击按钮可折叠列表框中的详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试做这样的事情:当你点击按钮时,listboxitem会折叠并显示一些额外的信息:



http://i.stack.imgur.com/klWck.png [ ^ ]



我已经做了类似的事情:细节是单击整个项目项时显示。任何想法如何修改这种风格,只有点击按钮(或它附近)才会发生折叠?





I'm trying do make something like this: when you click the button, the listboxitem collapses and shows some additional information:

http://i.stack.imgur.com/klWck.png[^]

I have already made something similar: details are showed when the whole item item is clicked. Any ideas how to modify this style so collapsing will take place only if the button (or near it) is clicked?


<Style x:Key="collapsingGridStyle" TargetType="{x:Type Grid}">
            <Style.Triggers>
                <DataTrigger
                   Binding="{Binding
                                Path=IsSelected,
                                RelativeSource=
                                {
                                    RelativeSource
                                    Mode=FindAncestor,
                                    AncestorType={x:Type ListBoxItem}
                                }
                        }"
                    Value="False">
                    <Setter Property="Grid.Visibility"
                    Value="Collapsed"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>

推荐答案

我在这里找到答案:使用ControlTemplate自定义WPF扩展器 [ ^ ]
I found answer here: Customizing WPF Expander with ControlTemplate[^]


这篇关于单击按钮可折叠列表框中的详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆