在AutoCompleteBox中控制ItemList的高度 [英] Control ItemList height in AutoCompleteBox

查看:82
本文介绍了在AutoCompleteBox中控制ItemList的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个自动填充框,每当我在其中输入一些键时,该框就会填充项目.我的问题是我需要控制自动填充列表项的高度.

我的自动完成功能始终需要显示15个项目,如果它包含更多项目,则需要滚动条.

Hi,

I have an autocomplete box which will populate items whenever I have entered some key in that. My problem is I need to control the height of the autocomplete listitems.

My autocomplete always needs to display 15 items, if it contains more items it will need a scroll bar.

<input:AutoCompleteBox Width="125" x:Name="EmployeeList" MinimumPrefixLength="1" Grid.Column="0"  HorizontalAlignment="Stretch" FilterMode="Contains"  Margin="2>
         <input:AutoCompleteBox.ItemTemplate>
             <DataTemplate >
                 <highlight:HighlightingTextBlock HighlightText="{Binding SearchText, ElementName=Employee}"  Text="{Binding}"/>
             </DataTemplate>
         </input:AutoCompleteBox.ItemTemplate>
     </input:AutoCompleteBox>

推荐答案



您可以通过将以下代码添加到样式表中来做到这一点:
Hi,

You can do that by adding this code into style-sheet:
ul {
height:170px;//you need to change the height value as much items you want
overflow:auto;
}



-----
问候,
Pavanraje Dongare
(向正确解决方案的唯一方法)



-----
Regards,
Pavanraje Dongare
(Unique way towards Right Solution)


我得到了解决方案,我们需要在自动填充框中添加一个属性MaxDropDownHeight ="220",以便我们可以控制自动填充项目列表的高度



Me got the solution we need to add one property MaxDropDownHeight="220" to the autocomplete box so that we can control the height of the Autocomplete itemlist



<input:AutoCompleteBox MaxDropDownHeight="220" Width="125" x:Name="EmployeeList" MinimumPrefixLength="1"

                           Grid.Column="0" HorizontalAlignment="Stretch" FilterMode="Contains" Margin="2>
                           <input:AutoCompleteBox.ItemTemplate>
//ur template
                           </input:AutoCompleteBox.ItemTemplate>
    </input:AutoCompleteBox>


这篇关于在AutoCompleteBox中控制ItemList的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆