Flex3里的ComboBox可以设置rowcount。但是spark.components.DropDownList里没有该属性。
最后仔细研究,发现奥妙全部都在skin里。
新建一个DropDownList的skin,关键属性处我已经设置成了加亮显示,自己一试便知。
<?xml version="1.0" encoding="utf-8"?>
<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:fb="http://ns.adobe.com/flashbuilder/2009" alpha.disabled=".5">
<fx:Metadata>
<![CDATA[
/**
* @copy spark.skins.spark.ApplicationSkin#hostComponent
*/
[HostComponent("spark.components.DropDownList")]
]]>
</fx:Metadata>
<s:states>
<s:State name="normal" />
<s:State name="open" />
<s:State name="disabled" />
</s:states>
<s:PopUpAnchor id="popUp" displayPopUp.normal="false" displayPopUp.open="true" includeIn="open"
left="0" right="0" top="0" bottom="0" itemDestructionPolicy="auto"
popUpPosition="below" popUpWidthMatchesAnchorWidth="true">
<s:Group id="dropDown" maxHeight="270" minHeight="22" >
<s:RectangularDropShadow id="dropShadow" blurX="20" blurY="20" alpha="0.45" distance="7"
angle="90" color="#000000" left="0" top="0" right="0" bottom="0"/>
<s:Rect id="border" left="0" right="0" top="0" bottom="0">
<s:stroke>
<s:SolidColorStroke id="borderStroke" weight="1"/>
</s:stroke>
</s:Rect>
<s:Rect id="background" left="1" right="1" top="1" bottom="1" >
<s:fill>
<s:SolidColor id="bgFill" color="0xFFFFFF" />
</s:fill>
</s:Rect>
<s:Scroller id="scroller" left="0" top="0" right="0" bottom="0" hasFocusableChildren="false" minViewportInset="1">
<s:DataGroup id="dataGroup" itemRenderer="spark.skins.spark.DefaultItemRenderer">
<s:layout>
<s:VerticalLayout gap="0" horizontalAlign="contentJustify" requestedRowCount="10"/>
</s:layout>
</s:DataGroup>
</s:Scroller>
</s:Group>
</s:PopUpAnchor>
<s:Button id="openButton" left="0" right="0" top="0" bottom="0" focusEnabled="false"
skinClass="spark.skins.spark.DropDownListButtonSkin" />
<s:Label id="labelDisplay" verticalAlign="middle" maxDisplayedLines="1"
mouseEnabled="false" mouseChildren="false"
left="7" right="30" top="2" bottom="2" width="75" verticalCenter="1" />
</s:SparkSkin>
分享到:
相关推荐
这个是ajax 实现DropDownList无刷新联动。里面有数据库结构和内容,表结构的是sql2000的, 关键代码: <SCRIPT language="javascript"> //城市------------------------------ function cityResult() ...
4. **事件处理函数**:在事件处理函数中,编写代码来根据主列表的选择更新从列表。这可能涉及数据库查询或计算新的选项集。 ```csharp protected void ddlMaster_SelectedIndexChanged(object sender, EventArgs ...
ASP .NET MVC4 @Html.DropDownList后台绑定数据展示到页面下拉框中
1. 在`DataList`模板中嵌入`DropDownList`,并为每个`DropDownList`设置唯一的ID。 2. 在`ItemDataBound`事件中,为每个`DropDownList`添加事件处理程序,并设置`AutoPostBack`为`True`。 3. 实现`...
### DropdownList三级联动效果知识点详解 #### 一、概述 在网页开发中,DropdownList(下拉列表)是一种常见的交互元素,被广泛应用于各种表单和数据筛选场景中。而“三级联动”的DropdownList则是指当用户选择第一...
在Web开发中,联动下拉框(DropDownList)是一种常见的交互设计,用于提供多级选择或筛选功能。AjaxPro.2是一个.NET框架下的Ajax库,它允许开发者在不刷新整个页面的情况下更新部分网页内容,从而提供更流畅的用户...
例如,如果数据源是SqlDataSource,设置`DropDownList.DataSourceID = "SqlDataSource1"`。 - **设置数据字段**:使用`DataTextField`指定显示的字段名,`DataValueField`指定选中项的值字段。例如,`DropDownList....
在上面的代码中,我们首先将数据源绑定到 DropDownList,然后设置 DataTextField 和 DataValueField 属性,最后使用 SelectedIndex 属性来设置选中项。 二、方法二:使用 for 循环或 do…while 循环 除了使用 ...
例如,GridView控件可以用于显示来自数据库的表格数据,而DropDownList控件则可以用来显示下拉列表。 #### 3. Web部件 Web部件是一种特殊的服务器控件,它提供了高度的可定制性和用户界面的个性化功能。Web部件可以...
首先,我们需要创建一个新的ActionScript类作为ItemRenderer,继承自mx.controls.listClasses.ListItemRenderer(对于Flex 4.x,可能是spark.components.LabelItemRenderer)。在ItemRenderer中,我们将添加一个...
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (this.DropDownList1.SelectedIndex == 0) { this.DropDownList2.Items.Clear(); this.DropDownList2.Items.Add("南阳...
这个实例主要探讨如何将DropdownList设置为只读模式,即用户不能从列表中进行选择,但仍然可以显示预设的值。下面我们将详细讲解实现这一功能的关键步骤和技术。 首先,我们从`Default.aspx`页面开始。在ASP.NET ...
- 根据需要设置DropDownList的DataSource属性,例如从另一个数据源。 - 调用DropDownList的DataBind方法来绑定数据。 - 可选:设置默认选定项,如果存在关联字段。 ```csharp protected void gvData_...
另一种动态绑定方法是利用`DropDownList.Items.Add()`方法逐个添加项。下面是一个示例,演示如何从数据库读取数据并添加到DropdownList: ```csharp if (!IsPostBack) { string ConnString = Configuration...
此外,为了实现下拉框的效果,他们可能使用了`mx.controls.DropDownList`或者`spark.components.ComboBox`,并在其`dataProvider`属性中设置了`Tree`控件,以展示树形结构的选项。 `GroupXML.xml`文件作为数据源,...
<TD><asp:dropdownlist id="DropDownList3" runat="server"></asp:dropdownlist> ; LEFT: 416px; POSITION: absolute; TOP: 48px" runat="server" Width="424px"></asp:TextBox><INPUT style="Z-INDEX: 103; ...
在前台代码中,我们需要添加三个DropDownList控件,并设置其AutoPostBack属性为True,以便在用户选择年或月时,自动更新日的选项。 ```html <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack=...
这个“webform dropdownlist.7z”压缩包可能包含了一系列关于如何使用和自定义DropdownList控件的示例代码和资源。让我们深入探讨一下DropdownList控件的相关知识点。 1. **DropdownList控件基本使用**: ...
4. 易于扩展:DropdownList的API设计简洁,开发者可以方便地添加新的功能或者调整已有功能,满足项目中的各种需求。 三、DropdownList的使用方法 1. 引入依赖:首先,需要在页面中引入jQuery库和DropdownList插件...
在ASP.NET 2.0的Web应用程序开发中,DropDownList控件和其他列表类控件广泛用于用户交互,尤其是在需要用户从预定义的选项中选择一个值的场景。这些控件的SelectedValue属性允许我们获取或设置当前选中的列表项的值...