博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
WPF Trigger for IsSelected in a DataTemplate for ListBox items
阅读量:6818 次
发布时间:2019-06-26

本文共 911 字,大约阅读时间需要 3 分钟。

Each "View" is an independent XAML file. I'd like to be able to set up the triggers in those files, looking at the ListBoxItem's IsSelected property, in order to control the visibility of the various controls within.The template to override the ListBoxItem follows: I modified the ContentPresenter in the following way in order to test out using the "FindAncestor" RelativeSource:
This works, but when I move similar code into the XAML file representing a View it no longer sees the trigger. For example:
How can I detect, preferably from the View's XAML file, when the ListBoxItem has been selected?
I notice that DataTrigger.Value property is missing in UserContrl's Style. With the following changes, I think your code would work.    

 

转载地址:http://ruszl.baihongyu.com/

你可能感兴趣的文章
mybatis同时启用mapperscanner和传统DAO
查看>>
Spring AOP 通过order来指定顺序
查看>>
记一次SQLServer的分页优化兼谈谈使用Row_Number()分页存在的问题
查看>>
Deci and Centi Seconds parsing in java
查看>>
TestNg依赖高级用法之强制依赖与顺序依赖------TestNg依赖详解(二)
查看>>
Javascript中构造函数与new命令
查看>>
java selenium webdriver处理JS操作窗口滚动条
查看>>
C#------数字转中文
查看>>
haproxy 实现多域名证书https
查看>>
ES mlockall作用——preventing that memory from being paged to the swap area
查看>>
How those spring enable annotations work--转
查看>>
【SFTP】使用Jsch实现Sftp文件下载-支持断点续传和进程监控
查看>>
Python--基础知识
查看>>
MySQL 定时任务
查看>>
jxl(Java Excel API) 使用方法 【1】
查看>>
Mac系统中各个文件夹简单介绍(转)
查看>>
流媒体技术学习笔记之(八)海康、大华IpCamera RTSP地址和格式
查看>>
[React] Test friendly approach
查看>>
MySQL InnoDB 引擎的持久性与性能
查看>>
java------HashMap与HashSet的区别
查看>>