Fayilt
Fayilt

Reputation: 1042

ComboBox DataTemplate Separator

I'm trying to create a DataTemplate for my class so the ComboBox displays two properties and then a separator. The problem is that I don't want to see a separator once I selected an item. My current template looks like this:

        <DataTemplate DataType="{x:Type j:Person}">
        <StackPanel>
            <TextBlock Text="{Binding Nick}" FontSize="14"></TextBlock>
            <TextBlock Text="{Binding FullName}"></TextBlock>
            <Separator/>
        </StackPanel>
       </DataTemplate>

Another problem is that the Separator is too short, it doesn't span the entire ComboBox width.

Any help appreciated.

Upvotes: 0

Views: 1299

Answers (1)

oddparity
oddparity

Reputation: 436

To stretch the Separator please use HorizontalContentAlignment="Stretch" on the ComboBox. Regarding the hiding of the Separator this could help: Displaying the selected item differently in ComboBox.

Upvotes: 2

Related Questions