[英]Collapse details in listbox by clicking a button
I'm trying do make something like this: when you click the button
, the listboxitem
collapses and shows some additional information: 我正在尝试做这样的事情:当您单击
button
, listboxitem
折叠并显示一些其他信息:
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?
任何想法如何修改此样式以便仅在单击按钮(或其附近)后才会崩溃?
Code : 代码 :
<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>
There are many ways how can you achieve this behavior. 有很多方法可以实现此行为。 For example, you can use expander in listboxitem template.
例如,您可以在listboxitem模板中使用扩展器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.