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

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