In the WPF example the Popup and the ToggleButton (the arrow on the right) are bound with the property IsDropDownOpen:

在模版里面设置

<Popup IsOpen="{TemplateBinding IsDropDownOpen}" ...

<ToggleButton IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" ...

A class Popup has the property StaysOpen that isn't specified in the standard template of a ComboBox and has a default value true. It follows that there is a subscription to the LostFocusevent in the internal implementation of a ComboBox, that sets IsDropDownOpen=false every time when the control lose a focus.

Silverlight has no bindings in xaml, but you will find the same sequence if you open the assembly in .Net Reflector.

 

WPF and Silverlight.ComboBox 如何通过 Binding IsDropDownOpen 实现下拉菜单展开的更多相关文章

  1. easyui combobox点击输入框弹出下拉框

    由于easyui combobox需要点击下拉箭头才能下拉,不能像select标签那样点击输入框就下拉,所以觉得不太方便,查看了一下,combobox弹出框是一个div,原本想在他的输入框的点击事件中 ...

  2. WPF 多项选择下拉菜单

    背景 项目中有一个多项选择筛选的功能, 由于筛选条件太多, 用户又习惯在平板上进行操作, 所以要求我们把checkbox 放到一个combobox里面, 然后checkbox的选项要在combobox ...

  3. 使用easyui combobox初始化+在input中触发下拉框+获取值

    效果图: 1.html <input id="alarmLeve" class="easyui-combobox" name="alarmLev ...

  4. C# winfrom ComboBox 调整下拉菜单的高度

    1.设置属性 // 1.属性设置 DrawMode ->OwnerDrawVariable this.cboBoxPostID.DrawMode = System.Windows.Forms.D ...

  5. Winform、WPF、Silverlight、MFC区别与联系

    WinForm 在Windows中,诸如窗体绘制等功能由GDI(图形设备接口)实现,放在操作系统内核中.Windows Forms在底层使用的是GDI+.GDI+是GDI的“面向对象包装”,使用C++ ...

  6. 自绘制HT For Web ComboBox下拉框组件

    传统的HTML5的下拉框select只能实现简单的文字下拉列表,而HTforWeb通用组件中ComboBox不仅能够实现传统HTML5下拉框效果,而且可以在文本框和下拉列表中添加自定义的小图标,让整个 ...

  7. 由于抽签HT For Web ComboBox下拉框组件

    传统HTML5的下拉框select仅仅能实现简单的文字下拉列表,而HT for Web通用组件中ComboBox不仅可以实现传统HTML5下拉框效果,并且可以在文本框和下拉列表中加入自己定义的小图标, ...

  8. thinter中combobox下拉选择控件(九)

    combobox控件,下拉菜单控件 combobox控件在tkinter中的ttk下 简单的实现下: import tkinter from tkinter import ttk # 导入ttk模块, ...

  9. Qt下拉对话框 ComboBox的用法

    介绍 ComboBox是Qt的下拉菜单的一个控件,通过下拉菜单选择不同的选项,样式如图: 基本用法 m_ComBox = ui.comboBox; //设置默认显示值的索引,从0开始 m_ComBox ...

随机推荐

  1. 第三章 八位数字开关板&模拟输入板&火焰传感器

    这节我将带大家了解亮宁机器人基础外接硬件. 八位数字板开关 接线方法:W1~W8接23~37号数字端口,Enter接39号数字端口,vcc和gnd分别接正负. #include <LNDZ.h& ...

  2. April 9 2017 Week 15 Sunday

    In the evening one may praise the day. 入夜方能赞美白昼. I think that could be understand in different ways, ...

  3. 什么是DTO?

    DTO: Data Transfer Object Wikipedia定义:Data transfer object (DTO)[1][2] is an object that carries dat ...

  4. jemter实战

    业务流梳理,需要实现的内容,含jdbc和正则表达式,和取值 1. 登录用户 2. 获取一个未分配的订单,判断是否是未分配 3. 获取配货单号 4. 分配配货单 5. 查询已分配的配货单 6. 查询包裹 ...

  5. 【转】Android UI开发第三十一篇——Android的Holo Theme

    好长时间没写Android UI方面的文章了,今天就闲扯一下Android的Holo主题.一直做android开发的可能都知道,Android 系统的UI有过两次大的变化,一次是android 3.0 ...

  6. 使用Sort方法对数组进行快速排序

    实现效果: 知识运用: Array类的Sort方法 public static void Sort(Array array)   // array:要排序的一维Array数组 实现代码: static ...

  7. 2017.9.18 include指令和include动作有什么区别?

    问题:include指令和include动作有什么区别? 答:include指令合并静态文档或Jsp页面中的内容,可以用于包括动态生成的输出结果,因此可以包含一个Servlet include指令在编 ...

  8. 2017.10.15 解析Java中抽象类和接口的区别

    (1)在Java语言中,abstract class 和interface 是支持抽象类定义的两种机制. 正是由于这两种机制的存在,才赋予了Java强大的 面向对象能力.abstract class和 ...

  9. FTP服务安装及使用

    准备工作:一台服务器.我这里使用的是阿里云的ECS. 环境使用的是:windows 2008 r2 用途:FTP是用来进行文件传输的,我们可以把这个目录在IIS上配置成发布的网站,我们在本地只用把我们 ...

  10. process launch failed: Security

    Xcode7/iOS9,真机测试的时候遇到这样的提示 通用-> 描述文件 -> 信任应用