您的位置:首页 > 运维架构

WPF and Silverlight.ComboBox 如何通过 Binding IsDropDownOpen 实现下拉菜单展开

2013-09-24 15:55 387 查看
IntheWPFexamplethePopupandtheToggleButton(thearrowontheright)areboundwiththepropertyIsDropDownOpen:

在模版里面设置

<PopupIsOpen="{TemplateBindingIsDropDownOpen}"...

<ToggleButtonIsChecked="{BindingPath=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSourceTemplatedParent}}"...

Aclass
Popup
hastheproperty
StaysOpen
thatisn'tspecifiedinthestandardtemplateofaComboBoxandhasadefaultvalue
true
.Itfollowsthatthereisasubscriptiontothe
LostFocus
eventintheinternalimplementationofaComboBox,thatsets
IsDropDownOpen=false
everytimewhenthecontrolloseafocus.

Silverlighthasnobindingsinxaml,butyouwillfindthesamesequenceifyouopentheassemblyin.NetReflector.


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐