WPF 控件样式之ComboBox 下拉菜单

ComboBox 下拉菜单

当选项过多时,使用下拉菜单展示并选择内容。

依次为普通ComboBox 、带清除的ComboBox、可编辑的ComboBox、带清除的可编辑ComboBox

使用方式

    <Page.Resources>
        <sysCollection:ArrayList x:Key="ComboBoxSource">
            <sys:String>黄金糕</sys:String>
            <sys:String>双皮奶</sys:String>
            <sys:String>蚵仔煎</sys:String>
            <sys:String>龙须面</sys:String>
            <sys:String>北京烤鸭</sys:String>
        </sysCollection:ArrayList>
    </Page.Resources>
    <WrapPanel Margin="20" x:Name="panel">
        <ComboBox  ItemsSource="{Binding Source={StaticResource ComboBoxSource}}"></ComboBox> 
        <ComboBox lib:Assists.Clearable="True" ItemsSource="{Binding Source={StaticResource ComboBoxSource}}"></ComboBox>
        <Separator Width="{Binding ElementName=panel,Path=ActualWidth}" Margin="0 20"></Separator>
        <ComboBox IsEditable="True" ItemsSource="{Binding Source={StaticResource ComboBoxSource}}"></ComboBox>
        <ComboBox IsEditable="True" lib:Assists.Clearable="True" ItemsSource="{Binding Source={StaticResource ComboBoxSource}}"></ComboBox>
    </WrapPanel>

源码地址:https://github.com/Super0Lan/ControlDesign

涉及到文件:ComboBoxAssit.cs;Themes/ComboBox.xaml;Assists.cs

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章