Skip to content

Commit 002619a

Browse files
authored
Merge pull request #487 from gehongyan/combobox-selectionbox
feat: ComboBox should respect SelectionBoxItemTemplate
2 parents 9cabf55 + f3c4714 commit 002619a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

demo/Semi.Avalonia.Demo/Pages/ComboBoxDemo.axaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
<ComboBox Classes="Small" />
2828
<ComboBox Classes="Bordered" />
2929
<ComboBox Classes="Bordered" IsEnabled="False" />
30+
<ComboBox>
31+
<ComboBox.SelectionBoxItemTemplate>
32+
<DataTemplate DataType="x:String">
33+
<ContentControl BorderThickness="1"
34+
BorderBrush="Gold"
35+
Content="{Binding}" />
36+
</DataTemplate>
37+
</ComboBox.SelectionBoxItemTemplate>
38+
</ComboBox>
3039

3140
<StackPanel Orientation="Horizontal">
3241
<ComboBox Width="100" Classes="Large" PlaceholderText="Large" />

src/Semi.Avalonia/Controls/ComboBox.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
7777
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
7878
Content="{TemplateBinding SelectionBoxItem}"
79-
ContentTemplate="{TemplateBinding ItemTemplate}" />
79+
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" />
8080
<Button
8181
Name="ClearButton"
8282
Grid.Column="1"

0 commit comments

Comments
 (0)